Skip to content

docs: Race the Optimistic Transforms demo's 5 clicks 120ms apart - #4489

Merged
ntucker merged 5 commits into
masterfrom
claude/project-thread-vjqv3m
Oct 27, 2026
Merged

ntucker merged 5 commits into
masterfrom
claude/project-thread-vjqv3m

Conversation

@ntucker

@ntucker ntucker commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 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

  • The race demo clicks 5 times, 120ms apart. The Store then steps through the 6 changes those clicks make and closes. The server-timings demo is unchanged.
  • The autoplay stage's 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

  • Measured on the dev server (Chromium), 2 runs: the 5 clicks land 155–201ms apart, down from about 475ms. The time beyond 120ms is the page handling each click in a dev build. A production build is likely faster; not measured, because the preview isn't reachable from this environment. Medium certainty.
  • In every run, Diff's "Next change" steps through 6 changes for the 5 clicks, and the Store closes about 2.6s after the last one. High certainty.
  • autorun.test.ts passes, with new tests for what point() returns (including when the layer moved under a target) and for a repeated click that skips the glide. High certainty.

@changeset-bot

changeset-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 08ac0e6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ntucker ntucker self-assigned this Oct 27, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T02:54:35.257428Z 2ca7ee0 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview: https://docs-site-pr-4489-data-client.vercel.app

Built from 08ac0e6 merged into master (this build). Locales: en (the merge queue builds every locale).

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
@ntucker ntucker changed the title docs(rest): Click the Optimistic Transforms race 20ms apart docs: Click the Optimistic Transforms race 20ms apart Oct 27, 2026
@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.37%. Comparing base (56e2bca) to head (08ac0e6).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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
@ntucker ntucker changed the title docs: Click the Optimistic Transforms race 20ms apart docs: Race the Optimistic Transforms demo's 5 clicks 100ms apart Oct 27, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MwXaUUnHx6HuRPR1t1D7US
@ntucker ntucker changed the title docs: Race the Optimistic Transforms demo's 5 clicks 100ms apart docs: Race the Optimistic Transforms demo's 5 clicks 120ms apart Oct 27, 2026
@ntucker
ntucker added this pull request to the merge queue Oct 27, 2026
Merged via the queue into master with commit bc1858f Oct 27, 2026
33 checks passed
@ntucker
ntucker deleted the claude/project-thread-vjqv3m branch October 27, 2026 03:03

This branch was successfully deployed

1 active deployment
docs-preview — 08ac0e61 Deployed Oct 27, 2026 by ntucker via preview / docs deploy #4255
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.

2 participants