Skip to content

fix(session): skip restored todo dock entrance animation - #781

Merged
Astro-Han merged 4 commits into
devfrom
pawwork/todo-widget-animation
May 20, 2026
Merged

fix(session): skip restored todo dock entrance animation#781
Astro-Han merged 4 commits into
devfrom
pawwork/todo-widget-animation

Conversation

@Astro-Han

@Astro-Han Astro-Han commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Treat active todo lists discovered while entering an existing session as restored state, not as a newly opened dock.
  • Gate the todo dock height spring so only newly created live todos replay the entrance animation; restored docks render at their settled height immediately.
  • Add unit, E2E, and snap coverage for restored todo dock behavior.

Test Plan

  • bun test --preload ./happydom.ts ./src/pages/session/todos/todo-dock-machine.test.ts
  • bun run typecheck
  • bun run test:e2e -- e2e/session/session-todo-dock-restore.spec.ts
  • bun run test:e2e -- e2e/session/session-composer-dock.spec.ts -g "todo dock (transitions and collapse behavior|appears from real todowrite)"
  • bun run snap todo-dock-restored; reviewed docs/design/preview/screenshots/todo-dock-restored.png

Notes

  • E2E output still includes existing Playwright/Node deprecation noise and an [e2e:pageerror] Object log on the restored-dock path; all assertions passed and exit codes were zero.

Summary by CodeRabbit

  • New Features

    • Todo dock now properly restores without entrance animation when reopening sessions.
  • Tests

    • Added end-to-end and unit tests to verify todo dock restoration behavior and state tracking.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Astro-Han has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 19 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 485cc5a5-f014-4a98-9c5a-dd1c50453272

📥 Commits

Reviewing files that changed from the base of the PR and between 0a1b337 and 6fac0ad.

📒 Files selected for processing (3)
  • packages/app/e2e/session/session-composer-dock.spec.ts
  • packages/app/src/pages/session/todos/use-session-todos.test.ts
  • packages/app/src/pages/session/todos/use-session-todos.ts
📝 Walkthrough

Walkthrough

This PR prevents the todo dock's entrance animation from replaying when a session with an existing todo dock is restored. The change introduces restoration tracking in the dock state machine, wires it through session todo handling, refactors animation logic in the composer region to suppress animation for restored sessions, and includes unit and E2E test coverage.

Changes

Todo Dock Restoration Without Animation Replay

Layer / File(s) Summary
Restore Tracker Core
packages/app/src/pages/session/todos/todo-dock-machine.ts
TodoDockRestoreTrackerInput type and createTodoDockRestoreTracker() function determine when a snapshot is restored based on known/count/phase/source transitions. reduceTodoDockState now suppresses the opening animation when input.restored is true.
Session Integration
packages/app/src/pages/session/todos/use-session-todos.ts
A restoredSnapshot tracker computes restoration status from snapshot/session data (whether session is known, has prior data, and phase indicates restoration). The dock input is wired to include the restored flag, passed during state machine initialization and snapshot transitions.
Animation Suppression
packages/app/src/pages/session/composer/session-composer-region.tsx
Introduces dockOpeningMotion signal to track dock entrance separately from spring animation. dockProgress snaps to 1 when dock is open but not opening, preventing animation replay for restored sessions.
Unit Test Coverage
packages/app/src/pages/session/todos/todo-dock-machine.test.ts
Tests validate restore tracker logic for unknown-to-known transitions, snapshot phase/source/count conditions, and confirm reduceTodoDockState correctly suppresses opening when restored.
Test Infrastructure
packages/app/src/testing/session-composer.ts
ComposerStateProbeState extends with optional openingSamples array to accumulate opening state across dock transitions for test assertions.
E2E Test Coverage
packages/app/e2e/session/session-composer-dock.spec.ts, packages/app/e2e/session/session-todo-dock-restore.spec.ts, packages/app/e2e/snap/todo-dock-restored.snap.ts
New session-todo-dock-restore E2E test and todo-dock-restored snapshot test validate dock restoration behavior. Dock test driver exposes readState(). Spec assertions check openingSamples tracking and restored height. Existing spec helper calls reformatted for readability.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

The changes span multiple connected files (state machine, session integration, animation logic) with moderate logic density and new tracking patterns. Core restore-tracker and animation logic require understanding the dock lifecycle and state machine design. Test coverage across unit and E2E layers adds verification breadth. Heterogeneous across animation, state management, and testing—no repetitive patterns reduce effort.

Possibly related issues

  • Astro-Han/pawwork#763: Directly addresses the todo-dock entrance animation flash on session mount by refactoring dockOpeningMotion tracking and snapping dockProgress to prevent replays.
  • Astro-Han/pawwork#66: Modifies the dock visibility and opening behavior through the restore tracker and state-machine logic that control when the dock is shown and animated.
  • Astro-Han/pawwork#323: Updates the same todo-dock state machine reducer and visibility/restoration tracking logic.

Possibly related PRs

  • Astro-Han/pawwork#394: Introduces the session todo/dock state-machine foundation that this PR builds on, extending the same reducer and integration points.
  • Astro-Han/pawwork#759: Also targets the todo-dock animation flash problem through session composer isolation and mutation observer checks, overlapping in shared spec updates and dock animation logic.
  • Astro-Han/pawwork#325: Modifies the shared stateProbe plumbing and todo-dock visibility assertions in E2E specs, extending the same test driver infrastructure.

Poem

🐰 A dock restored need not dance anew,
The frame stays still, no flash in view,
We track when sessions wake again,
And let the motion settle in!
thump thump

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'fix(session): skip restored todo dock entrance animation' directly and clearly describes the main change—preventing entrance animation replay for restored todo docks.
Description check ✅ Passed The PR description covers all required sections: Summary explains the changes, Test Plan documents verification steps with checkmarks, and Notes address known issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pawwork/todo-widget-animation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Astro-Han Astro-Han added bug Something isn't working app Application behavior and product flows ui Design system and user interface P2 Medium priority labels May 20, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested priority: P2 (includes user-path files (packages/app/src/pages/session/composer/session-composer-region.tsx, packages/app/src/pages/session/todos/todo-dock-machine.test.ts, packages/app/src/pages/session/todos/todo-dock-machine.ts, packages/app/src/pages/session/todos/use-session-todos.ts)).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements logic to skip the todo dock entrance animation when restoring an existing session, ensuring the UI immediately displays the settled height for historical data. It introduces a TodoDockRestoreTracker and updates the state machine and UI components to suppress animations for restored sessions, supported by new E2E and unit tests. Feedback identifies a bug in the snapshotKnown function where an overly broad condition incorrectly flags new sessions as restored, causing the entrance animation to be skipped for new todos.

Comment thread packages/app/src/pages/session/todos/use-session-todos.ts
@github-actions

github-actions Bot commented May 20, 2026

Copy link
Copy Markdown

Perf delta summary

Comparator: pass

Profile / Scenario interaction median interaction worst long task max tbt frame gap p95 frame gap max jank count cls status
default / homepage-cold 48 -> 40 (-8) 64 -> 48 (-16) 78 -> 65 (-13) 28 -> 15 (-13) 33.4 -> 16.8 (-16.6) 150 -> 116.6 (-33.4) 5 -> 3 (-2) 0 -> 0 (0) pass
default / long-session-input-lag 48 -> 40 (-8) 48 -> 48 (0) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 16.7 (-0.1) 16.8 -> 16.8 (0) 0 -> 0 (0) 0 -> 0 (0) pass
default / session-streaming-long 48 -> 48 (0) 64 -> 72 (+8) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 16.7 (-0.1) 33.4 -> 16.8 (-16.6) 0 -> 0 (0) 0 -> 0 (0) pass
default / tool-call-expand 16 -> 16 (0) 16 -> 24 (+8) 0 -> 0 (0) 0 -> 0 (0) 16.7 -> 16.8 (+0.1) 16.7 -> 16.8 (+0.1) 0 -> 0 (0) 0 -> 0 (0) pass
default / tool-default-open-heavy-bash 32 -> 24 (-8) 32 -> 32 (0) 69 -> 69 (0) 19 -> 19 (0) 49.9 -> 66.7 (+16.8) 166.7 -> 166.7 (0) 3 -> 5 (+2) 0 -> 0 (0) pass
default / terminal-side-panel-open 48 -> 56 (+8) 56 -> 56 (0) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 33.3 (+16.5) 33.4 -> 33.4 (0) 0 -> 0 (0) 0 -> 0 (0) pass
default / session-scroll-reading 24 -> 32 (+8) 32 -> 32 (0) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 16.7 (-0.1) 16.8 -> 16.7 (-0.1) 0 -> 0 (0) 0.505 -> 0.505 (0) warn: cls
low-end / session-scroll-reading-long 80 -> 64 (-16) 184 -> 64 (-120) 104 -> 76 (-28) 79 -> 38 (-41) 16.8 -> 16.8 (0) 233.4 -> 133.3 (-100.1) 3 -> 3 (0) 0.011 -> 0.011 (0) pass
low-end / session-timeline-recompute 136 -> 136 (0) 160 -> 136 (-24) 129 -> 119 (-10) 254 -> 218 (-36) 116.6 -> 116.6 (0) 200 -> 183.4 (-16.6) 4 -> 3 (-1) 0.081 -> 0.081 (0) pass
low-end / concurrent-shimmer-extreme 0 -> 0 (0) 0 -> 0 (0) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 16.8 (0) 16.8 -> 16.8 (0) 0 -> 0 (0) 0 -> 0 (0) pass

@Astro-Han
Astro-Han merged commit 6247818 into dev May 20, 2026
26 checks passed
@Astro-Han
Astro-Han deleted the pawwork/todo-widget-animation branch May 20, 2026 07:10
@coderabbitai coderabbitai Bot mentioned this pull request May 23, 2026
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows bug Something isn't working P2 Medium priority ui Design system and user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant