fix(webviews): New Tab chats stop replaying motion when the page loads

Merged
TE
19d ago
+147-2

Every time a New Tab page loaded, including when a workspace switch showed or woke one, its Chats list replayed its motion: cards slid and faded in although nothing new had happened.

The page builds the cards from two sources (recentChatCards). The app pushes the device chats right away, so the first frame lists those. Then acpmux's session list lands, and the live chats take the top slots under their session ids while the same chats' device rows drop out. useListMotion saw new keys and animated the whole swap.

useListMotion now moves rows only for a real insert or removal: at most one row arriving and at most one leaving per update. A bigger swap is a load and is drawn in place, the way the first render is. Closing a tab still slides Recently Closed and fades its new row in, and a chat that starts while the page shows still fades in. A load also cancels any slide still running.

Tests

  • webviews/test/new-tab-chats-load-motion.test.tsx, committed red first (72fb399b99). The device-chat list, then the live sessions landing, now starts no animation; a single new chat still fades in. bun test test/new-tab-chats-load-motion.test.tsx: 1 fail before the fix, 2 pass after.
  • bun test test/new-tab test/newtab: 73 pass, 0 fail (11 browser-lane tests skipped locally).
  • CMUX_BROWSER_TESTS=1 bun test test/new-tab-list-motion.test.ts (real Chromium, close-a-tab motion): 2 pass.

Changelog

  • Fixed: The New Tab page's Chats list no longer slides and fades every time the page loads or a workspace switch shows it.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the New Tab page's Chats list replaying its slide-and-fade motion on every page load and workspace switch.

The list builds from two sources: device chats render first, then acpmux's session list lands and swaps the same chats under new keys, which useListMotion previously animated as a change. Motion now runs only for a real insert or removal, meaning at most one row arriving and one leaving; a larger swap is treated as a load and drawn in place. Closing a tab still slides the Recently Closed row, and a chat that starts while the page shows still fades in. A regression test in webviews/test/new-tab-chats-load-motion.test.tsx covers both paths.