Repository navigation
spec(react-component-runtime): a shared concern is extended in its hook, and components call it once - #9139
Conversation
…ok, and components call it once
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec a1562d4 |
PR Analysis Report
📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: The accessibility audit did not run on this pull request. It runs after merges to Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Changes requested: the direction of INV16 is approved, but its wording conflicts with other claims in the same record and needs three small edits before merging.
- INV16 reaches Lab through
applies_to, yet INV10 and INV11 tell components outside Core to keep their own Effect or listener (Lab'sChatTypingIndicatorcallsuseAnnounceand keeps one Effect), so scope INV16 to Core or carve those cases out. - Dialog already calls
useInteractionModalityTracking()and runs its owntrackInteractionModalityInEffect, so INV16 needs an implementation-gap note, and the description should not say modality already lives in one place. - The INV16 row reviews only components that call the shared owner; widen it so a component that keeps its own listener without calling the owner also fails.
[Automated review]
| - **INV16 — A shared concern is extended in its owner and called once.** A | ||
| concern Core already owns in a shared hook or utility is extended there; a | ||
| component calls it once and adds no effect, listener, or tracker of its own | ||
| for that concern. |
There was a problem hiding this comment.
As worded this reaches Lab too (applies_to includes packages/lab/src/), but INV10 tells packages outside Core to "keep one well-behaved Effect per adopter" and INV11 tells a component outside Core to keep one keyboard listener. Lab's ChatTypingIndicator (calls useAnnounce, keeps its own Effect) would fail INV16 while following INV10. Suggest scoping it like INV10-INV12 ("In @astryxdesign/core, …") or adding "A component outside Core that cannot import the owner follows that concern's own invariant (INV10, INV11)." Dialog also fails this today (useInteractionModalityTracking() plus its own trackInteractionModalityIn Effect), so an implementation-gap note would keep the record honest.
| | INV12 | Source boundary check plus real-browser tests on a throttled phone profile over a 10-level by 50-sibling tree and two changes in one frame | A per-frame height or layout, a walk past the area or into a subtree other than `display: contents`, an element moved twice for one frame, an added element other than a swap's one transient copy, that copy left after the swap ends, or an exported reporting function fails | | ||
| | INV13 | Source boundary check plus bundle analysis of a page with several touch components, and real-browser tests on a throttled phone profile, under a fine pointer, and on a hybrid device | A second copy of a touch module on one page, a component bundling its own copy of a module's primitive, an `import()` of a module in a component, a public export or doc entry for the modules, an install call or installed check in the public API, a gesture listener in a component that uses no gesture, or an idle document listener outside a press other than the one shared press controller and the one stray-click swallower, an import of `@astryxdesign/core/internal/*` outside Core and Lab, a class outside the recognizer family, an `instanceof` check on a recognizer, an internal factory with a public factory's name, or a direct module import for a job the public layer covers fails | | ||
| | INV15 | Unit tests of the animator's value mode and real-browser proofs of its adopters | A value off its motion role, a count past the component's swap size, a count or cross-fade under reduced motion with a coarse or a fine pointer, an intermediate value announced, or a public export fails | | ||
| | INV16 | Review of each component that calls a shared concern's hook or utility | A component that calls a shared concern's hook or utility and also registers its own effect, listener, or tracker for that concern fails | |
There was a problem hiding this comment.
This row only reviews components that call the owner and only fails one that calls it and also adds its own effect. A component that keeps its own listener for the concern without calling the owner passes, though INV16 forbids it. Suggest: evidence "Review of each component that handles a concern a shared hook or utility owns", failure "…registers its own effect, listener, or tracker for that concern, whether or not it also calls the owner, fails".
… gap, widen its check
|
/approve-spec ba0fa14 |
There was a problem hiding this comment.
Changes requested: INV16 is now scoped to Core, records the Dialog gap and catches a component that skips the shared owner, but its implementation-gap note still reads as if Dialog were the only Core component that fails it. At this head MobileNav locks page scroll in its own Effect (MobileNav.tsx:588) instead of the shared useScrollLock, and DateInput's month scroller (MonthScroller.tsx:418), DropdownMenu's overflow check, Layer positioning and Table's sticky columns each create their own ResizeObserver beside sharedResizeObserver. Please add these to INV16's gap note and to the description's "one implementation gap", or name the concerns INV16 covers so they fall outside it.
[Automated review]
| tracker of its own for that concern. (Implementation gap: Dialog calls | ||
| `useInteractionModalityTracking()` and also keeps its own Effect that tracks | ||
| modality in a second document.) |
There was a problem hiding this comment.
This note names only Dialog, but the widened row at line 417 also fails MobileNav, which locks page scroll in its own Effect (MobileNav.tsx:588) instead of useScrollLock, and the per-instance ResizeObservers in DateInput's MonthScroller.tsx:418, DropdownMenu's useMenuOverflow.ts:47, useLayer.tsx:810 and useTableStickyColumns.tsx:581, beside sharedResizeObserver (line 378). Suggest listing them here, e.g. "(Implementation gaps: Dialog …; MobileNav locks page scroll in its own Effect beside useScrollLock; DateInput's month scroller, DropdownMenu's overflow check, Layer positioning and Table sticky columns create their own ResizeObserver beside sharedResizeObserver.)"
|
/approve-spec bdaf2d3 |
There was a problem hiding this comment.
Changes requested: INV16's gap note now names Dialog, MobileNav and four ResizeObserver sites, but the note and the description still present that list as complete. BottomSheet (useSheetGestures.ts:738, useMobileKeyboard.ts:380) and Popover (Popover.tsx:751) also keep their own ResizeObserver beside sharedResizeObserver, and ten Core sites keep their own MutationObserver beside sharedMutationObserver. Please reword the note as non-exhaustive ("Known implementation gaps include: …"), add the BottomSheet and Popover observers to the ResizeObserver gap, and change the description's "lists the known implementation gaps" to match.
[Automated review]
| tracker of its own for that concern. (Implementation gaps: Dialog calls | ||
| `useInteractionModalityTracking()` and also keeps its own Effect that tracks | ||
| modality in a second document; MobileNav keeps its own page scroll lock | ||
| Effect instead of `useScrollLock`; and DateInput's month scroller, | ||
| DropdownMenu's overflow check, Layer positioning, and Table's sticky columns | ||
| each keep their own `ResizeObserver` beside `sharedResizeObserver`.) |
There was a problem hiding this comment.
This list reads as complete, but BottomSheet (useSheetGestures.ts:738, useMobileKeyboard.ts:380) and Popover (Popover.tsx:751) also keep their own ResizeObserver beside sharedResizeObserver. Ten Core sites keep their own MutationObserver beside sharedMutationObserver (for example useMenuOverflow.ts:51, Popover.tsx:755, useToast.tsx:54). Suggest "(Known implementation gaps include: …; BottomSheet's sheet height and keyboard reveal, DateInput's month scroller, DropdownMenu's overflow check, Layer positioning, Popover's overflow check, and Table's sticky columns each keep their own ResizeObserver beside sharedResizeObserver.)"
|
/approve-spec e36e28a |
There was a problem hiding this comment.
Recommending approval: INV16 is owner-approved at this head, and the gap note now reads as non-exhaustive and covers the BottomSheet and Popover observers raised earlier. Knowledge validation passes, and no other change is needed before merge.
[Automated review]
…ce and modality tracking With #9139's INV16 on main, the runtime record owns two more concerns: slot-presence (isRenderable, or a typeof ... !== 'boolean' check) and modality-tracking (useInteractionModalityTracking, or a pointerdown or keydown listener) both route INV16, beside interaction-modality's own INV1-INV3 for modality. Tests: #8236's Badge check routes INV16 naming isRenderable; #8381's diff now also routes INV16.
Behavior Core owns in one shared hook or utility, such as focus-ring modality, should be the same in every component and frame. This rule keeps that logic in the shared owner, so a component does not split it between the hook and an effect of its own.
Change
architecture:react-component-runtimegains INV16: in@astryxdesign/core, a concern Core already owns in a shared hook or utility is extended there; a component calls it once and adds no effect, listener, or tracker of its own for that concern. INV16 names known implementation gaps (not exhaustive): Dialog keeps its own modality Effect for a second document beside the shared modality hook; MobileNav keeps its own page scroll lock Effect instead ofuseScrollLock; BottomSheet's gestures and mobile keyboard, DateInput's month scroller, DropdownMenu's overflow check, Layer positioning, Popover, and Table's sticky columns each keep their ownResizeObserverbesidesharedResizeObserver; and other Core sites keep their ownMutationObserverbesidesharedMutationObserver. The verification table gains one INV16 review row: a Core component that keeps its own effect, listener, or tracker for such a concern fails, whether or not it also calls the shared owner. INV16 is added to the record'sreact-runtimereview routing.Writing rubric results
R1 narration: none; INV16, its gap list, and its row are present-tense statements about the system.
R2 research: none.
R3 evidence: the INV16 row names a review check, not a pull request, issue, or commit.
R4 rejected alternatives: none.
R5 change references: none.
R6 open questions: none.