Repository navigation
fix(useLayer): read committed callbacks and open state - #10912
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| LayerProvider | 4.4 kB (0) · 20 B CSS (0) | — | ✓ · ✓ · ✗ |
| lab/CommentComposer | 156.5 kB (+91 B) · 1.9 kB CSS (0) | — | — · — · — |
| Link | 55.2 kB (+84 B) · 7.1 kB CSS (0) | — | — · — · — |
115 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TabList | 46.5 kB (+82 B) · 6.5 kB CSS (0) | — | — · — · — |
| SideNav | 118.4 kB (+76 B) · 11.7 kB CSS (0) | — | — · — · — |
| TopNavHeading | 80.3 kB (+73 B) · 11.6 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 73.2 kB (+72 B) · 10.1 kB CSS (0) | — | — · — · — |
| SideNavHeading | 80.8 kB (+72 B) · 11.6 kB CSS (0) | — | — · — · — |
| StatusDot | 32.9 kB (+72 B) · 5.4 kB CSS (0) | — | — · — · — |
| Toolbar | 46.3 kB (+71 B) · 8.1 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 352.9 kB (+71 B) · 2.4 kB CSS (0) | — | — · — · — |
| SideNavItem | 75.3 kB (+70 B) · 11.5 kB CSS (0) | — | — · — · — |
| AvatarGroup | 47.8 kB (+69 B) · 5.8 kB CSS (0) | — | — · — · — |
| TopNav | 75.8 kB (+69 B) · 11.3 kB CSS (0) | — | — · — · — |
| lab/ListInput | 91.6 kB (+69 B) · 922 B CSS (0) | — | — · — · — |
| Selector | 105.4 kB (+68 B) · 17.8 kB CSS (0) | — | — · — · — |
| Pagination | 115.6 kB (+67 B) · 18.2 kB CSS (0) | — | — · — · — |
| Switch | 106.9 kB (+67 B) · 10.0 kB CSS (0) | — | — · — · — |
| MultiSelector | 99.8 kB (+66 B) · 17.2 kB CSS (0) | — | — · — · — |
| TopNavMenu | 79.7 kB (+66 B) · 11.6 kB CSS (0) | — | — · — · — |
| NumberInput | 75.1 kB (+64 B) · 11.8 kB CSS (0) | — | — · — · — |
| Typeahead | 85.9 kB (+63 B) · 12.8 kB CSS (0) | — | — · — · — |
| ChatComposer | 82.9 kB (+62 B) · 12.4 kB CSS (0) | — | — · — · — |
| Thumbnail | 67.9 kB (+62 B) · 11.9 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 301.8 kB (+62 B) · 2.6 kB CSS (0) | — | — · — · — |
| richtext/RichTextView | 280.0 kB (+62 B) · 2.3 kB CSS (0) | — | — · — · — |
| charts/ChartTooltip | 186.7 kB (+61 B) · 451 B CSS (0) | — | — · — · — |
| lab/TransferList | 105.8 kB (+61 B) · 1.2 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 89.9 kB (+60 B) · 12.5 kB CSS (0) | — | — · — · — |
| CheckboxList | 71.9 kB (+60 B) · 7.8 kB CSS (0) | — | — · — · — |
| Avatar | 44.9 kB (+59 B) · 5.6 kB CSS (0) | — | — · — · — |
| TableCell | 114.5 kB (+59 B) · 18.2 kB CSS (0) | — | — · — · — |
| Tokenizer | 102.1 kB (+59 B) · 19.5 kB CSS (0) | — | — · — · — |
| CodeBlock | 78.7 kB (+58 B) · 11.6 kB CSS (0) | — | — · — · — |
| PowerSearch | 300.1 kB (+58 B) · 24.7 kB CSS (0) | — | — · — · — |
| lab/Comments | 359.6 kB (+58 B) · 2.5 kB CSS (0) | — | — · — · — |
| lab/Schedule | 110.1 kB (+56 B) · 3.9 kB CSS (0) | — | — · — · — |
| ChatDictationButton | 64.0 kB (+55 B) · 10.4 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 114.1 kB (+55 B) · 18.0 kB CSS (0) | — | — · — · — |
| DropdownMenu | 102.5 kB (+54 B) · 17.9 kB CSS (0) | — | — · — · — |
| IconButton | 63.5 kB (+54 B) · 10.3 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 111.9 kB (+54 B) · 1.1 kB CSS (0) | — | — · — · — |
| Banner | 65.5 kB (+53 B) · 10.8 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 73.7 kB (+53 B) · 13.6 kB CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 86.6 kB (+53 B) · 372 B CSS (0) | — | — · — · — |
| ChatSendButton | 63.9 kB (+52 B) · 10.3 kB CSS (0) | — | — · — · — |
| TextInput | 71.1 kB (+52 B) · 11.5 kB CSS (0) | — | — · — · — |
| Tooltip | 31.1 kB (+52 B) · 4.4 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 284.5 kB (+52 B) · 454 B CSS (0) | — | — · — · — |
| AlertDialog | 109.3 kB (+51 B) · 15.0 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 63.8 kB (+51 B) · 10.3 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 74.5 kB (+51 B) · 12.2 kB CSS (0) | — | — · — · — |
| charts/Chart | 209.6 kB (+50 B) · 516 B CSS (0) | — | — · — · — |
| Button | 63.5 kB (+50 B) · 10.3 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 74.5 kB (+50 B) · 11.7 kB CSS (0) | — | — · — · — |
| ContextMenu | 113.3 kB (+50 B) · 17.8 kB CSS (0) | — | — · — · — |
| Stepper | 65.2 kB (+50 B) · 10.5 kB CSS (0) | — | — · — · — |
| TabMenu | 77.1 kB (+50 B) · 11.5 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 110.7 kB (+50 B) · 773 B CSS (0) | — | — · — · — |
| AvatarGroupOverflow | 50.9 kB (+49 B) · 5.7 kB CSS (0) | — | — · — · — |
| Calendar | 74.5 kB (+49 B) · 10.9 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 80.6 kB (+49 B) · 11.6 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 80.6 kB (+49 B) · 11.6 kB CSS (0) | — | — · — · — |
| DialogHeader | 66.3 kB (+49 B) · 11.8 kB CSS (0) | — | — · — · — |
| FieldLabel | 54.3 kB (+49 B) · 5.7 kB CSS (0) | — | — · — · — |
| DrawerHeader | 66.5 kB (+48 B) · 13.3 kB CSS (0) | — | — · — · — |
| ListItem | 73.7 kB (+48 B) · 11.7 kB CSS (0) | — | — · — · — |
| Markdown | 193.5 kB (+48 B) · 21.0 kB CSS (0) | — | — · — · — |
| MobileNav | 74.1 kB (+48 B) · 11.0 kB CSS (0) | — | — · — · — |
| RadioList | 59.6 kB (+48 B) · 7.3 kB CSS (0) | — | — · — · — |
| TextArea | 65.6 kB (+48 B) · 9.4 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 64.4 kB (+47 B) · 10.4 kB CSS (0) | — | — · — · — |
| TimeInput | 167.6 kB (+47 B) · 16.4 kB CSS (0) | — | — · — · — |
| Toast | 101.3 kB (+47 B) · 10.6 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 91.0 kB (+47 B) · 2.1 kB CSS (0) | — | — · — · — |
| MoreMenu | 102.7 kB (+46 B) · 17.9 kB CSS (0) | — | — · — · — |
| ChatLayout | 86.3 kB (+43 B) · 10.9 kB CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 64.1 kB (+43 B) · 10.5 kB CSS (0) | — | — · — · — |
| DateRangeInput | 97.6 kB (+43 B) · 12.9 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 59.3 kB (+42 B) · 1.2 kB CSS (0) | — | — · — · — |
| Field | 58.2 kB (+41 B) · 7.3 kB CSS (0) | — | — · — · — |
| Table | 130.4 kB (+41 B) · 18.7 kB CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 96.0 kB (+41 B) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 114.6 kB (+41 B) · 1.4 kB CSS (0) | — | — · — · — |
| CheckboxInput | 67.7 kB (+40 B) · 10.1 kB CSS (0) | — | — · — · — |
| InfoTip | 49.4 kB (+39 B) · 5.4 kB CSS (0) | — | — · — · — |
| ComplexSelector | 75.9 kB (+38 B) · 12.2 kB CSS (0) | — | — · — · — |
| ToggleButton | 90.2 kB (+38 B) · 10.4 kB CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 67.6 kB (+38 B) · 162 B CSS (0) | — | — · — · — |
| RadioListItem | 70.8 kB (+37 B) · 10.4 kB CSS (0) | — | — · — · — |
| InputGroup | 59.9 kB (+36 B) · 7.9 kB CSS (0) | — | — · — · — |
| Slider | 112.4 kB (+35 B) · 8.8 kB CSS (0) | — | — · — · — |
| lab/TourStep | 101.7 kB (+35 B) · 590 B CSS (0) | — | — · — · — |
| DateInput | 193.6 kB (+33 B) · 17.4 kB CSS (0) | — | — · — · — |
| HoverCard | 29.3 kB (+33 B) · 4.4 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 90.4 kB (+31 B) · 751 B CSS (0) | — | — · — · — |
| AppShell | 95.3 kB (+29 B) · 13.8 kB CSS (0) | — | — · — · — |
| DateTimeInput | 216.1 kB (+29 B) · 19.1 kB CSS (0) | — | — · — · — |
| Lightbox | 126.8 kB (+29 B) · 10.9 kB CSS (0) | — | — · — · — |
| FileInput | 72.5 kB (+26 B) · 11.3 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 76.7 kB (+25 B) · 11.3 kB CSS (0) | — | — · — · — |
| SegmentedControl | 100.2 kB (+23 B) · 6.9 kB CSS (0) | — | — · — · — |
| Carousel | 73.2 kB (+22 B) · 11.3 kB CSS (0) | — | — · — · — |
| Popover | 95.4 kB (+18 B) · 14.6 kB CSS (0) | — | — · — · — |
| ChatMessageList | 29.9 kB (+1 B) · 7.1 kB CSS (0) | — | — · — · — |
| ProgressBar | 12.0 kB (+1 B) · 6.4 kB CSS (0) | — | — · — · — |
| Spinner | 26.5 kB (+1 B) · 6.2 kB CSS (0) | — | — · — · — |
| Timestamp | 35.1 kB (+1 B) · 10.6 kB CSS (0) | — | — · — · — |
| Text | 13.6 kB (0) · 5.5 kB CSS (0) | — | — · — · — |
| Timer | 15.7 kB (0) · 6.0 kB CSS (0) | — | — · — · — |
| ChatToolCalls | 34.1 kB (−1 B) · 8.4 kB CSS (0) | — | — · — · — |
| CommandPalette | 75.2 kB (−1 B) · 12.7 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 33.6 kB (−1 B) · 7.6 kB CSS (0) | — | — · — · — |
| charts/ChartLegend | 53.8 kB (−2 B) · 224 B CSS (0) | — | — · — · — |
| Heading | 14.1 kB (−2 B) · 5.5 kB CSS (0) | — | — · — · — |
| lab/LineClamp | 15.7 kB (−2 B) · 168 B CSS (0) | — | — · — · — |
| layer | — | — | — · ✓ · — |
| Layer | — | — | ✓ · ✓ · — |
Package size: @astryxdesign/core 7.38 MB packed (+256 B); no new dependencies.
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: moving the three ref writes to commit is the right fix, and both new tests fail on main and pass here, but two things need to change first.
- Popover is the only caller of
onCloseStartand passessurfaceMotion.closeStart, which is the same function in every render, so please describe the close-start sync as preventive in the User impact section and reword the changeset (which also files the keep-open sync, used only by Selector and MultiSelector, under Popover, Tooltip, HoverCard and the menus), for example to "[fix] The layer runtime syncs its close-start, replayed-show and keep-open refs at commit, not during render, so a render React discards no longer leaves its values for later callbacks." - No test fails when the replayed-show sync (
useLayer.tsx:1761-1766) goes back to the render-time write, so please add one beside the existing replay test that commitsonShowA, discards a render withonShowB, replays the show and checks that only A runs.
Optional: split each insertion-effect comment into two sentences, one for what it syncs and one for why it runs before layout effects.
[Automated review]
72f5b31 to
f9d8b18
Compare
|
/approve-spec f9d8b18 |
There was a problem hiding this comment.
Changes requested: the close-start and replayed-show syncs are right, and each new test fails on main and passes here, but the keep-open change needs another pass.
- Miss: when a MultiSelector opens through
handleRefinside a transition that has not committed, the list is shown while the committedisOpenis still false, so the press handler (useLayer.tsx:1157-1164) no longer names Clear all an invoker and pressing it closes the list, which stays open on main; please have the press read the layer's live open state (for example a getter over the runtime's ownisOpenRef, whichshowandhideset beside the DOM call) and add a MultiSelector-level test for a show inside a pending transition. - Miss: the User impact section says a Selector or MultiSelector keep-open press could toggle the layer shut after a discarded render that said it was closed, but both pass the layer's own state, which turns false only after a hide has already hidden the layer (
useLayer.tsx:1746-1752), so please describe the keep-open change as preventive for these callers or describe what the corrected fix changes.
Optional: await act(async () => runToggleTasks()) at useLayer.test.tsx:1537 removes the "act call was not awaited" warning that the replay test prints. CI has not run on this head yet; once the pull request is ready, a maintainer adds the ci:run label.
[Automated review]
| }); | ||
|
|
||
| // The hide ends at its toggle, and the parked show replays. | ||
| act(() => runToggleTasks()); |
There was a problem hiding this comment.
Non-blocking: this synchronous act runs while the discarded transition is still pending, so React prints "A component suspended inside an act scope, but the act call was not awaited". await act(async () => runToggleTasks()); keeps the test log clean.
There was a problem hiding this comment.
Kept the synchronous act here on purpose: with await act(async () => runToggleTasks()) this test passes on main (the whole file then fails 2 tests on main, not 3), so it no longer catches the render-time showRef write. The synchronous form keeps it red on main and green at this head.
f9d8b18 to
2110306
Compare
|
/approve-spec 2110306 |
There was a problem hiding this comment.
Changes requested: the close-start and replayed-show syncs are right, and each red-first test fails on main and passes here, but two things need to change.
- The keep-open press finds the layer with
ownerDocument.getElementById(useLayer.tsx:1162), so a Selector or MultiSelector inside a shadow root that opens in a pending transition closes when its Clear all control is pressed, where main keeps it open; look the layer up incontrol.getRootNode()instead and add a shadow-root case to the pending-show test. - The description's keep-open user impact still names Selector and MultiSelector users for a discarded render that says the layer is closed, but both callers' open state turns false only after the layer is already hidden, so please mark that part preventive as the close-start bullet is.
A non-blocking comment-wording suggestion is inline.
[Automated review]
The layer kept its close-start callback, its replayed show and, for a control on its trigger, its open state in refs written while it rendered. A render React discards, as a suspended transition does, left its values there. A hide then reported its close start to the discarded render's callback, and a press on a keep-open control read the discarded open state. The two the layer calls from its own show and hide sync in insertion effects, ahead of any layout effect that shows or hides the layer in that commit. The keep-open press holds no ref now. It reads the committed open state, or a layer the runtime already shows ahead of that state.
2110306 to
90fa9a1
Compare
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet; it runs once the pull request is marked ready for review and a maintainer adds the ci:run label.
The two commit-time ref syncs and the tree-scoped keep-open lookup fix the earlier findings, and each ref has a red-first test that fails on main.
- Non-blocking: no test pins the insertion timing; layout or passive effects also pass every
useLayertest. - The earlier suggestion to await the replay test's
actis withdrawn: awaiting it lets that test pass on main.
[Automated review]
|
/approve-spec 90fa9a1 |
The hide's close-start callback now comes from useCommittedRef, listed in the deps of the two callbacks that read it. The replayed show stays a plain ref, since a callback declared above it reads it, and useCommittedRefInto writes it. Both write at commit, before any layout effect, as the insertion effects they replace did.
|
/approve-spec 1b6e941 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet; it runs once the pull request is marked ready for review.
The close-start and replayed-show refs now go through the shared commit-time hook, the keep-open press reads the committed open state or the shown layer, and each ref has a red-first test. There are no blocking findings.
Claims and files checked
- Claims:
- The changeset's fix (close-start and replayed-show refs synced at commit; keep-open press reads the committed open state or the shown layer): verified in
useLayer.tsx. - Three render-time ref writes are removed, one per ref: verified.
- Popover and ContextMenu pass
onOpenChangethroughonShow: verified. - Popover is the only close-start caller and passes a stable function, so that case is preventive: verified.
- Selector and MultiSelector pass the layer's own open state, so the discarded-closed keep-open case is preventive: verified.
- Both refs are written at commit, before any layout effect: verified (the shared hook's insertion effect).
- The runtime shows the layer before its open state commits: verified.
- Three red-first tests fail on main, one per ref: consistent with the code, since each asserts the value main's render-time write replaces; CI confirms the run.
- The two guards fail at the earlier heads: consistent with those heads' press handlers.
- No API, visual or default change: verified.
- The related suites, typecheck and lint pass: CI confirms these.
- The open #8125 merges cleanly with this change: verified.
- The merge of main kept both sides of its one conflict, and the next commit moves the two refs onto the shared hook: verified.
- The changeset's fix (close-start and replayed-show refs synced at commit; keep-open press reads the committed open state or the shown layer): verified in
- Files:
.changeset/layer-refs-at-commit.md: clear.packages/core/src/Layer/useLayer.tsx: clear.packages/core/src/Layer/useLayer.test.tsx: clear.
Main brings in meta#10912, which changes Layer/useLayer.tsx, the layer the mode hint shows. The merge needs no hand edit.
…10815) * refactor(List): write the reorder refs at commit, not in render Conformance tidy, no visible change. The reorder session's list getter and the mode hint's layer handle were copied into refs during render. Each is now written in a one-line layout effect, so a render React discards leaves nothing behind. No failure is reachable today. Every list getter returns the same element. The layer ref's only reader is the hint's layout effect. It reads the ref at the commit, right after the committed render wrote it. The cleanup uses the handle it captured. * fix(List): a reorder handle's name follows its row's place and label A reorder handle named itself from the DOM in a passive effect: after Item's label element when that element shows a name, else after the row's place ("Reorder item N"). The effect ran only when the handle rendered. A memoized row whose place changed, because a row above it went or the rows reordered, kept the old place in its handle's name. A label that gained or lost its text through its own state left the handle named the old way. The reorder session now reads both from the DOM, outside React. It registers the list's rows and its handles' label elements with Core's shared mutation observer, and releases them with the list. It keeps each handle's label naming, and the place only for a handle named after it. The handle reads them through useSyncExternalStore, as it reads reorder mode, and renders its name from them. Only a change renders the handle again, so its passive effect is gone. A row named after its place still warns in development, once, from the session. positionOf loses its last caller and goes. The session follows the list element the List renders, which changes when its numbering turns on or off. ListReorderNames.test.tsx covers a row above that goes, a reorder, and a label that gains and loses text: each fails on main and passes here. A reorder after the numbering turns on passes on both. * Merge main 1740654 into the reorder handle names Main brings in #11199, whose controller reads a collection's rows through a reader, and #11352's committed-ref hook. #11199 edits positionOf, which this branch removes; it stays removed. One hand edit: refreshNames reads this.rows.read(list) instead of rowsOf(list), as #11199's positionOf did, so a collection's own reader numbers its rows. * refactor(List): the reorder refs use the committed-ref hook The session's list getter and the mode hint's layer handle were each copied into a ref by a one-line layout effect. They now use Core's useCommittedRef, which writes them in a commit-phase insertion effect. The session's useMemo lists the stable getter ref in its dependencies. No behavior changes. Every getter List passes reads the same list ref when called, and the hint's effect reads the handle after either write. A handle's cleanup can reach the getter through release(), and gets the same list. The hint's cleanup hides the handle its setup showed, so no cleanup reads the layer ref. * fix(List): an unchanged handle name keeps its snapshot The names refresh compared each handle's name with the session's own entry, which a handle named some other way has none of before the first read. So it stored a new {position: null, labelNamesRow: null} and the handle rendered again with the same name on every mount (architecture:react-component-runtime INV9). It now compares with handleNameOf, whose shared unread name has the same fields. A test counts the handle's renders through the verb it reads each render: once per handle on mount, and once for a row that mounts later. * fix(List): a hydrated handle keeps its server snapshot The handle's server snapshot was its own unread name, and the session answered an unread handle with another object with the same fields. So after hydration React saw a new snapshot, and each handle rendered again with the same name (architecture:react-component-runtime INV9). The handle now exports one unread name, and the session answers with it. A test hydrates server markup and counts the handle's renders through the verb it reads each render: once per handle. * fix(List): a label that names its row keeps the unread snapshot The names refresh stored whether Item's label element names the row: null before the first read, and true after it, though the handle and the session read both alike. So a handle named by its row's text label rendered again with the same name after mounting and after hydrating (architecture:react-component-runtime INV9). The snapshot now records whether the label shows no name, which stays false until a read finds the label blank. Both render-count cases add a row named by its text label. * Merge main 06b7e61 into the reorder handle names Main brings in #10912, which changes Layer/useLayer.tsx, the layer the mode hint shows. The merge needs no hand edit. * Merge main 31aacff into the reorder handle names Main brings in #11336, which changes List/ListItem.tsx, the row that renders the reorder handle. The merge needs no hand edit.
Render-time ref writes fixed, each read in a callback:
isOpenRefinuseKeepLayerOpenProps, andonCloseStartRefandshowRefin the layer runtime, all incore/Layer/useLayer.tsx. Red-first: yes, three new tests fail on main, one per ref.User impact
People using a layer whose callbacks change between renders, with transitions. The layer kept its close-start callback, its replayed show and, for a control on its trigger, its open state in refs written while it rendered. A render React discards, as a suspended transition does, left its values there:
onShow. Popover and ContextMenu pass the publiconOpenChangethere.Problem and solution fit
A write during render runs for every render, including the ones React throws away. Each is read after a commit.
The close-start callback now comes from
useCommittedRef. The replayed show stays a plain ref for a callback declared above it, written byuseCommittedRefInto. Both write at commit, before any layout effect that shows or hides the layer.The keep-open press holds no ref now. Its handler reads the committed
isOpen, or a layer already shown in the control's own tree. The runtime shows the layer before its open state commits.Expected behavior and authority
useRefcontract: do not writeref.currentduring rendering, except to initialize it.architecture:react-component-runtimeINV3 and INV17: a latest-value ref goes throughuseCommittedRefor itsuseCommittedRefIntoform, and render writes no ref. INV4: no rendered value comes from a ref mutation.Smallest restoration
Three refs in
useLayer.tsx. No API, visual or default changes.Evidence
Scope
Testing
All runs below are at this PR's head, 1b6e941.
Each test commits one set of props, then renders others in a transition while a sibling suspends for good, so React never commits that render.
onCloseStartRefuseCommittedRefhide(): the committedonCloseStartis called, and the discarded one is not.isOpenRef(useKeepLayerOpenProps)isOpen, or the shown layershowRefuseCommittedRefIntoonShow: the replay calls the committedonShow.pnpm exec vitest run packages/core/src/Layer packages/core/src/Popover packages/core/src/Selector packages/core/src/MultiSelector packages/core/src/DropdownMenu packages/core/src/ContextMenu packages/core/src/Tooltip packages/core/src/HoverCard --project ui: 78 files, 2078 tests pass.useLayer.test.tsxrun whole against main's runtime: the three red-first tests fail, and the other 152 pass.@astryxdesign/coretypecheck: 0 errors. ESLint and Prettier on the changed files: clean.#8125touches this file elsewhere, and merges clean with this change.useLayer.tsx, where main added two options beside the close-start callback. Both sides are kept. The next commit moves the two refs ontouseCommittedRefanduseCommittedRefInto.