Skip to content

fix(sidebar): show rows whose reorder fade never finishes - #4586

Open
matt2e wants to merge 4 commits into
mainfrom
jitter/sidebar-reorder-fade-fallback
Open

matt2e wants to merge 4 commits into
mainfrom
jitter/sidebar-reorder-fade-fallback

Conversation

@matt2e

@matt2e matt2e commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Problem

When activity reorders a sidebar section by more than two places, ChannelSidebarRows fades the moving rows out and applies the new order only after every faded row reports that its fade completed (applyOrder). Nothing else ends the batch. If a single completion never arrives, the whole batch stays at opacity: 0 until a membership change, a collapse or a drag resets it. A section then shows a block of blank rows: in the desktop dev build, eight Team rows stayed blank for about 9 seconds before the reorder landed.

Change

src/features/channel-navigation/ChannelSidebarRows.tsx: while a batch is fading, a 500ms deadline applies the prepared order and clears the fade. That is five times the 100ms fade, so a normal fade always finishes first. Completion and deadline share finishBatch, and a new batch or cancellation clears the timer through the effect cleanup.

Demo

On-screen captions show elapsed time and how many rows are invisible. This is a standalone WebKit page that mounts the real ChannelSidebarRows. To reproduce the stall on demand, each fade-out is held one millisecond short of its end, so its completion never fires. I couldn't trigger that cause naturally (see Validation).

sidebar-fade-before-after.mp4

Validation

  • New Vitest case shows distant rows in their new order when a fade never finishes: fails on main (the order never applies), passes here. All 417 tests in src/features/channel-navigation/ pass.
  • navigation-sorting.spec.mjs on WebKit: 14/14 pass.
  • biome check and tsc --noEmit are clean.
  • Root cause not pinned down. Here's what didn't reproduce a stall on main: WebKit stress journeys on the full app (55 rounds of bursty live activity under Recent sort, with and without row clicks during fades), a standalone harness with 40 rounds of random reorder churn, a container hidden mid-fade, and Fast Refresh of the rows module, its CSS or the host. This change makes the batch recover whatever the cause.

🤖 Generated with Claude Code

A distant sidebar reorder fades the moving rows out and applies the new
order only after every one of them reports its fade complete. A single
missing report left the whole batch at opacity 0 until a membership
change, collapse or drag reset it, which shows up as a block of blank
rows in a section.

Give the batch a deadline well past the 100ms fade, so it always
applies the new order and fades the rows back in.

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>
@matt2e
matt2e marked this pull request as ready for review December 1, 2026 01:47
@matt2e
matt2e requested a review from a team as a code owner December 1, 2026 01:47
matt2e and others added 3 commits December 1, 2026 15:25
The distant-jump journey pauses the fade-out while it inspects it, then
calls finish() to release it. finish() completed every paused
animation. Now that a held fade has a deadline, the app can apply the
new order by itself while the test is still inspecting, so finish()
also completed the fade-in the test was about to observe and the
journey failed on WebKit with no partial frame at the new position.

Make finish() release only the animations a seek has already stepped;
release() still finishes everything. Poll for the animation at short
intervals so a seek finds the fade-out well inside the deadline rather
than after the default backoff has grown past it.

No assertion changes, and the deadline is unchanged.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The distant-jump journey found the fade-out by polling from the test
runner, then stepped it. The app now applies the new order by itself
500ms after a fade starts, so a runner that took longer than that to
look found the fade-in instead and the journey failed with no partial
frame at the old position. That happened once in a WebKit flake-check
shard.

Move the wait into the page. A seek now registers with the animate
hook, which steps the animations as soon as enough of them exist, in
the same task that created them. Add arm(), which starts a seek before
the test triggers the motion, and use it for the fade-out. The time the
runner takes to notice the fade no longer matters.

seek() keeps its meaning for the other callers, and still fails after
10s if the animation never appears. No assertion changes, and the
deadline is unchanged.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The distant-jump journey samples the moving row once per rendering
update, and the hold steps the paused fade-out to 0, 25%, 50% and 75%
with a frame between steps. A partial reading at the old slot therefore
needed two rendering updates after the fade-out existed. WebKit on
Linux can take longer than the app's 500ms fade deadline to deliver
those first updates after an opacity animation starts, so the app
applied the new order before the sampler saw a partial frame and the
journey failed with oldFade false.

Show every step once in the task that starts the seek, then again for
a frame each as before, and announce each step with an event. The
distant-jump sampler also takes a reading on that event, so the
readings no longer depend on when a frame arrives. Each one is still
the computed style and geometry of the browser's own animation, and
goes through the same checks as the per-frame readings.

This changes what oldFade proves. It now proves the fade-out leaves
the row partially transparent at the old slot, read at each held step.
It no longer proves that a rendering update happened during the hold.

No assertion changes, and the deadline is unchanged.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.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