Repository navigation
docs: Race the Optimistic Transforms demo's 5 clicks 120ms apart - #4489
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MwXaUUnHx6HuRPR1t1D7US
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Docs preview: https://docs-site-pr-4489-data-client.vercel.app Built from 08ac0e6 merged into |
A repeated click on the same button waited out the pointer's ~400ms glide each time, so the race demo's 20ms clicks landed ~420ms apart. The stage now says whether the pointer moved, and the player waits only when it did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MwXaUUnHx6HuRPR1t1D7US
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4489 +/- ##
=======================================
Coverage 98.37% 98.37%
=======================================
Files 161 161
Lines 3080 3080
Branches 605 605
=======================================
Hits 3030 3030
Misses 10 10
Partials 40 40 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Compare its position in the layer, which scrolls with the page, so a scroll under a sticky target still glides it back before the click. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MwXaUUnHx6HuRPR1t1D7US
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MwXaUUnHx6HuRPR1t1D7US
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MwXaUUnHx6HuRPR1t1D7US
🤖 Generated with Claude Code
https://claude.ai/code/session_01MwXaUUnHx6HuRPR1t1D7US
Motivation
The Optimistic Transforms race demo on the optimistic updates guide should click its upvote in a quick burst, so the race between in-flight increments is obvious. Its script spaced the clicks 75ms apart, but the player waited out the pointer's ~400ms glide before every click, even when the pointer was already on the button. So the clicks really landed about half a second apart.
Solution
point()now reports whether the pointer moved, compared where it's drawn in its layer, which scrolls with the page. The player waits out the glide only when the pointer moved, so repeated clicks on the same button no longer pause between them.Preview: https://docs-site-pr-4489-data-client.vercel.app/rest/guides/optimistic-updates
Assumptions and validation
autorun.test.tspasses, with new tests for whatpoint()returns (including when the layer moved under a target) and for a repeated click that skips the glide. High certainty.