Repository navigation
Conversation
useTabBarLens copied selectedIndex, onLift and isDisabled into refs during render, and its end-of-press function too. A render React discards, as a suspended transition does, left its values there for the press, the lift and the tab-list effect. Each ref is now written in a one-line layout effect, and the press ending's comes before the effect that reads it.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
AI review status for this pull request.
|
Contributor
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
Contributor
Author
|
Closed per the spec owners: folds into the next TabBar lens PR as a tidy. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User impact
People using Lab's TabBar in an app that renders with transitions.
useTabBarLenscopiedselectedIndex,onLiftandisDisabledinto refs during render, and its press-ending function too. A render React discards, as a suspended transition does, left them there for the next press:onLift, which TabBar builds over that render's items.Problem and solution fit
The press, its moves and the lift run later, against the committed bar. A write during render runs for every render, including the ones React throws away, so they read props from a screen nobody saw.
Each ref is now written in a one-line layout effect, with a note naming what it syncs. The press-ending function's effect comes before the tab-list effect that calls it.
Expected behavior and authority
useRefcontract: do not writeref.currentduring rendering, except to initialize it.architecture:react-component-runtimeINV3 and INV4.Smallest restoration
Four refs in
useTabBarLens.ts. No API, visual or default changes.Evidence
Scope
Testing
All runs below are at this PR's head, 160798b.
selectedRefselectedIndexprop. No handler here sees it change.onLiftRefonLiftprop, which TabBar builds each render.isDisabledRefisDisabledprop.endRefpnpm exec vitest run packages/lab/src/TabBar --project ui: 3 files, 68 tests pass.@astryxdesign/labtypecheck, source and docs: 0 errors. ESLint and Prettier on the changed file: clean.A parked draft, #9701, touches the same lines: its ref block and its press-ending block. Its owner prefers that whichever lands second takes the short rebase.