Skip to content

apply animations directly to dom - #85

Merged
hipstersmoothie merged 5 commits into
mainfrom
dom-experiment
Jul 8, 2026
Merged

apply animations directly to dom#85
hipstersmoothie merged 5 commits into
mainfrom
dom-experiment

Conversation

@hipstersmoothie

@hipstersmoothie hipstersmoothie commented Jun 29, 2026

Copy link
Copy Markdown
Owner

When animating the dividers using react state can lead to a janky animation

This PR modifies the state machine to apply layouts directly to the dom when animating, fixing the jank issues.

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-window-splitter Ready Ready Preview, Comment Jul 7, 2026 4:22pm
react-window-splitter-storybook Ready Ready Preview, Comment Jul 7, 2026 4:22pm
solid-window-splitter Error Error Jul 7, 2026 4:22pm

Request Review

@hipstersmoothie hipstersmoothie added the minor Increment the minor version when merged label Jun 29, 2026
vikr01 and others added 3 commits July 7, 2026 04:38
…e-0 hitch

prepare() rewrites the template (% to px, same rendered width, different
string). Committing that through React fires a Layout pass before the raf
loop starts, producing a visible hitch on frame 0.

Apply the same skipOnUpdate treatment applyDelta already gets: write the
post-prepare() template directly to the DOM and skip the React commit.
The closing transition("idle") at animation-end flushes context to React
normally, so final state converges. Guarded by getGroupElement to preserve
old behavior for consumers that haven't opted in.
The initial patch skipped transition()'s internal onUpdate but send() has
its own trailing onUpdate?.(context) that would still fire after
transition() returns for a collapsePanel/expandPanel event. React batches
the two setStates into one commit, so suppressing only one still leaves
the frame-0 React commit + Layout intact.

Fix: transition() returns whether it did a direct DOM write; send()
propagates that into its own skipOnUpdate at the two call sites.

Added a state-level test asserting that collapsePanel with getGroupElement
fires zero onUpdate calls until animation-end, and that the grid template
is written synchronously.
…apse

Also skip onUpdate on transition into togglingCollapse to remove frame-0 hitch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Increment the minor version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants