lint: forbid inline mergeRefs calls - #5269
Open
nynexman4464 wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
nynexman4464
marked this pull request as ready for review
August 20, 2026 23:18
nynexman4464
force-pushed
the
fix/enforce-stable-merged-refs
branch
from
August 20, 2026 23:21
cc26880 to
2f21b9b
Compare
nynexman4464
force-pushed
the
fix/enforce-stable-merged-refs
branch
from
August 20, 2026 23:30
2f21b9b to
d9b991f
Compare
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsAppShell (@astryxdesign/core) · View in Storybook
AvatarGroup (@astryxdesign/core) · View in Storybook
BottomSheet (@astryxdesign/core) · View in Storybook
Breadcrumbs (@astryxdesign/core) · View in Storybook
ButtonGroup (@astryxdesign/core) · View in Storybook
Carousel (@astryxdesign/core) · View in Storybook
Chat (@astryxdesign/core) · View in Storybook
CheckboxInput (@astryxdesign/core) · View in Storybook
ClickableCard (@astryxdesign/core) · View in Storybook
CommandPalette (@astryxdesign/core) · View in Storybook
ContextMenu (@astryxdesign/core) · View in Storybook
DateInput (@astryxdesign/core) · View in Storybook
DateTimeInput (@astryxdesign/core) · View in Storybook
Dialog (@astryxdesign/core) · View in Storybook
FileInput (@astryxdesign/core) · View in Storybook
Heading (@astryxdesign/core) · View in Storybook
Item (@astryxdesign/core) · View in Storybook
Lightbox (@astryxdesign/core) · View in Storybook
MobileNav (@astryxdesign/core) · View in Storybook
NavMenu (@astryxdesign/core) · View in Storybook
Outline (@astryxdesign/core) · View in Storybook
OverflowList (@astryxdesign/core) · View in Storybook
Overlay (@astryxdesign/core) · View in Storybook
PowerSearch (@astryxdesign/core) · View in Storybook
Resizable (@astryxdesign/core) · View in Storybook
SegmentedControl (@astryxdesign/core) · View in Storybook
SelectableCard (@astryxdesign/core) · View in Storybook
SideNav (@astryxdesign/core) · View in Storybook
Slider (@astryxdesign/core) · View in Storybook
Switch (@astryxdesign/core) · View in Storybook
TabList (@astryxdesign/core) · View in Storybook
Text (@astryxdesign/core) · View in Storybook
TextArea (@astryxdesign/core) · View in Storybook
TextInput (@astryxdesign/core) · View in Storybook
TimeInput (@astryxdesign/core) · View in Storybook
Timestamp (@astryxdesign/core) · View in Storybook
Token (@astryxdesign/core) · View in Storybook
TopNav (@astryxdesign/core) · View in Storybook
Typeahead (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 12 accessibility violation(s) found — 11 serious, 1 moderate. Chat - 1 issue(s)
ClickableCard - 1 issue(s)
FileInput - 1 issue(s)
Heading - 1 issue(s)
Outline - 1 issue(s)
OverflowList - 1 issue(s)
PowerSearch - 1 issue(s)
SelectableCard - 1 issue(s)
TabList - 1 issue(s)
Text - 1 issue(s)
Timestamp - 1 issue(s)
Token - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
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.
Stack
This is 3 of 3 in GitHub stack #5270:
useMergedRefsand fixText/HeadingReview and land in this order. This PR is based directly on #5267, after core has been migrated cleanly.
Why enforcement is needed
The unsafe code looks natural:
But
mergeRefs(...)is a callback factory. Calling it during render creates a new ref callback every time, forcing React to detach and reattach an unchanged element. #5266 shows that this can escalate into React error #185 when a ref callback schedules state during commit.Providing
useMergedRefsis not enough by itself: the unsafe utility remains available for non-React composition, and the inline JSX form is easy to reintroduce.There is direct ecosystem precedent. Radix added
scripts/check-composed-refs.mjsafter the same React 19 “Maximum update depth exceeded” failure (radix-ui/primitives#3963). Its guard rejects the same two patterns enforced here.What the rule rejects
Raw callback factory in JSX
Unstable input that defeats the hook
What remains valid
The rule follows imported bindings, including aliases, and does not flag an unrelated local function that happens to be named
mergeRefs.Why this is a separate PR
Enforcement lands last so it never creates an unfixable lint failure:
The rule applies to core only; lab is intentionally outside this migration's scope.
Validation
pnpm lintpasses with zerono-inline-merge-refsviolationsmergeRefs