Remove react/no-unstable-nested-components overrides and fix violations - #1454
Draft
stipsan wants to merge 6 commits into
Draft
Remove react/no-unstable-nested-components overrides and fix violations#1454stipsan wants to merge 6 commits into
stipsan wants to merge 6 commits into
Conversation
The error boundary's onDidCatch handler built JSX inline, which oxlint's react/no-unstable-nested-components flagged as a component defined during render. The toast description only depends on render-scope values, so it's hoisted out of the handler and the inline disable directive is removed.
…rappers DocumentInNode and NodeActions defined memoized forwardRef components during render to inject router props into ChildLink/IntentLink. Replace them by passing the link component via the as prop and spreading the router props directly onto Card/MenuItem, which forward them at runtime.
Dialog footer/header elements and react-virtuoso/react-select itemContent callbacks were defined as components during render. Inline the dialog footers/headers as elements and move the list renderers to module scope, passing per-render data through react-virtuoso's data/context props.
The media and hierarchical-document-list source no longer defines components during render, so the per-plugin rule disables are no longer needed and the rule is now enforced everywhere.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Resolves conflicts from main's PR #1363 (ban forwardRef; migrate to React 19 ref-as-prop), which independently made the same as-prop fix to the hierarchical plugin. - DocumentInNode.tsx / NodeActions.tsx: convergent change (both removed the forwardRef link wrappers and used as={ChildLink}/as={IntentLink}). Took main's canonical version (@ts-expect-error for the polymorphic as props) for repo-wide consistency, and dropped the now-redundant hierarchical-document-list changeset (main has its own). - AssetGridVirtualized/index.tsx: combined main's forwardRef->ref-as-prop ItemContainer/ListContainer with this branch's module-scope renderCell + react-virtuoso data/context (the media no-unstable-nested-components override is removed here, so the renderer must stay hoisted). Import resolved to the union (memo + GridItemContent, no forwardRef). - .oxlintrc.json: auto-merged (main's forwardRef ban + both no-unstable-nested- components overrides removed).
🦋 Changeset detectedLatest commit: c39d34e The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Resolves conflicts after main migrated lint config and expanded media folders: - .oxlintrc.json (modify/delete): accept main's deletion; the config now lives in oxlint.config.ts. Re-applied this PR's media react/no-unstable-nested-components override removal there (hierarchical override was already gone on main). - AssetGridVirtualized: combine main's folder cards + source prop with this branch's module-scope renderCell, passing selectedIds/source via context. - AssetTableVirtualized: widen TableContext items to include CardFolderData after main's folder support landed in the auto-merge. - DialogFolderCreate (new on main): inline its Footer element so removing the media override still leaves the rule clean.
✅ E2E Tests🟢 24 passed • view full report • view run Studio: https://plugins-e2e-test-studio-9e83mdymx.sanity.dev Datasets: |
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.
What & why
react/no-unstable-nested-componentswas disabled forsanity-plugin-media(and previously also for@sanity/hierarchical-document-list) plus an inline disable insanity-plugin-mux-input. This PR removes those suppressions and fixes the underlying violations so the rule is enforced repo-wide.Walkthrough
Media asset dialog shows its inlined header/footer; the react-select tag dropdown renders options + the "Create …" entry from module-scope renderers.
media_asset_dialog_and_tag_dropdown.mp4
Virtualized grid/table and tag dialog (renderers moved to module scope, data via react-virtuoso
data/context):Media grid virtualized
Media table virtualized
Media create tag dialog
Changes (this PR’s diff vs
main)sanity-plugin-mediaDialogConfirm/DialogTagCreate/DialogTagEdit/DialogAssetEdit/DialogFolderCreate): inlineFooter/Headeras elements on thefooter/headerprops (also drops stalereact/react-compilerdisable directives where present).AssetGridVirtualized/AssetTableVirtualized/TagsVirtualizedand react-selectsingle/creatablemenu lists: moveitemContent/groupContentrenderers to module scope; pass per-render values through react-virtuosodata/context(grid context carriesselectedIds+sourcefor main’s folder/sourcesupport).sanity-plugin-mux-inputErrorBoundaryCard: hoist the crash-toast description out ofonDidCatchand remove the inline disable.oxlint.config.tssanity-plugin-mediareact/no-unstable-nested-components: offoverride.Testing (post-merge)
pnpm formatpnpm lint(type-aware oxlint,--deny-warnings)pnpm build— 52/52 taskspnpm test run— 209 files / 1269 testsTo show artifacts inline, enable in settings.