Skip to content

fix(sidebar): show initial rows that return after their exit finished - #4595

Draft
matt2e wants to merge 1 commit into
mainfrom
jitter/sidebar-fade-root-cause
Draft

matt2e wants to merge 1 commit into
mainfrom
jitter/sidebar-fade-root-cause

Conversation

@matt2e

@matt2e matt2e commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Why

#4586 stops a reorder batch from waiting forever on a lost fade completion. It doesn't cover the other way a sidebar row goes blank. In that case the batch isn't stuck. Motion has left the row's opacity at 0.

It happens when a row that was there at first render leaves the sidebar and comes back after its exit fade has finished, but before AnimatePresence has unmounted it. AnimatePresence keeps finished rows mounted until every exiting row is done. When that row re-enters, Motion 12 jumps its opacity to the initial value of 0 and replays the enter. The replay is blocked, because AnimatePresence initial={false} marks rows from the first render with blockInitialAnimation. The row ends up visible to layout, focusable, and invisible for good.

Motion fixed this upstream in 13.4.4: its exit feature now clears blockInitialAnimation on re-entry. We pin motion 12.40.0, and two major bumps are too much for this fix.

What

ChannelSidebarRows no longer passes initial={false} to AnimatePresence. Each row gets initial={false} only if it mounts in the first render, which skips the same first-render fade without ever blocking a later enter. A row that re-enters now fades back to opacity 1.

This can be reverted once we're on Motion 13.4.4 or later.

Testing

  • A new Vitest case, "shows an initial row that returns after its exit finished", fails on main (opacity stays 0) and passes with this change. afterEach now drains Motion's pending frame after real-timer tests too. Without that, the frame is stranded when the next test switches to fake timers.
  • Replayed a recorded sidebar update sequence 20 times in headless WebKit. It left a row stuck at opacity 0 in 6 of 20 runs on main and 0 of 20 with this change.
  • tests/browser/navigation-sorting.spec.mjs: 44 passed (Chromium and WebKit).

🤖 Generated with Claude Code

A sidebar row that was there at first render could come back
invisible. When a row leaves and returns after its exit fade has
finished, but before AnimatePresence removes it (it waits for every
exiting row), Motion jumps the row to its `initial` opacity of 0 and
replays the enter. Before Motion 13.4.4, AnimatePresence initial={false}
still blocks that replay for rows from the first render, so the row
stays at opacity 0 for good.

Skip the first render's fade per row with `initial={false}` instead, so
AnimatePresence never blocks an enter.

Co-authored-by: Jitter <2b2e6415e748c35180847a37aadae06a11e30dddc76b784e7fd9354c4eb42e7a@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant