Skip to content

Remove react/no-unstable-nested-components overrides and fix violations - #1454

Draft
stipsan wants to merge 6 commits into
mainfrom
cursor/remove-no-unstable-nested-components-e888
Draft

Remove react/no-unstable-nested-components overrides and fix violations#1454
stipsan wants to merge 6 commits into
mainfrom
cursor/remove-no-unstable-nested-components-e888

Conversation

@stipsan

@stipsan stipsan commented Jun 30, 2026

Copy link
Copy Markdown
Member

What & why

react/no-unstable-nested-components was disabled for sanity-plugin-media (and previously also for @sanity/hierarchical-document-list) plus an inline disable in sanity-plugin-mux-input. This PR removes those suppressions and fixes the underlying violations so the rule is enforced repo-wide.

Merged main: Lint config now lives in oxlint.config.ts (.oxlintrc.json was deleted). Hierarchical already lost its override on main via the earlier forwardRef migration; this PR removes the remaining media override from oxlint.config.ts and keeps media/mux-input source fixes green against main’s newer folder-management UI.

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-media

  • Dialogs (DialogConfirm / DialogTagCreate / DialogTagEdit / DialogAssetEdit / DialogFolderCreate): inline Footer/Header as elements on the footer/header props (also drops stale react/react-compiler disable directives where present).
  • AssetGridVirtualized / AssetTableVirtualized / TagsVirtualized and react-select single/creatable menu lists: move itemContent/groupContent renderers to module scope; pass per-render values through react-virtuoso data/context (grid context carries selectedIds + source for main’s folder/source support).

sanity-plugin-mux-input

  • ErrorBoundaryCard: hoist the crash-toast description out of onDidCatch and remove the inline disable.

oxlint.config.ts

  • Remove the sanity-plugin-media react/no-unstable-nested-components: off override.

Testing (post-merge)

  • pnpm format
  • pnpm lint (type-aware oxlint, --deny-warnings)
  • pnpm build — 52/52 tasks
  • pnpm test run — 209 files / 1269 tests

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

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.
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plugins-studio Ready Ready Preview, Comment Jun 30, 2026 1:42pm

Request Review

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-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c39d34e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
sanity-plugin-media Patch
sanity-plugin-mux-input Patch

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.
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

✅ E2E Tests

🟢 24 passedview full reportview run

Studio: https://plugins-e2e-test-studio-9e83mdymx.sanity.dev

Datasets: pr-1454-chromium-30817865845, pr-1454-firefox-30817865845

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 31.96% 5485 / 17160
🔵 Statements 31.73% 5788 / 18239
🔵 Functions 27.63% 1417 / 5128
🔵 Branches 23.32% 2819 / 12085
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
plugins/sanity-plugin-media/src/components/AssetGridVirtualized/index.tsx 51.61% 23.07% 28.57% 50% 25-37, 44-48, 58-59, 72-73, 89-94
plugins/sanity-plugin-media/src/components/AssetTableVirtualized/index.tsx 16.66% 0% 0% 18.18% 32-56, 60, 63-64, 68-85
plugins/sanity-plugin-media/src/components/DialogAssetEdit/index.tsx 69.38% 59.55% 66.66% 72.09% 34, 97, 122-123, 162, 174-177, 184-189, 196, 204, 212, 222, 231-259, 266, 288-292, 305, 321-323, 330-335, 348, 438
plugins/sanity-plugin-media/src/components/DialogConfirm/index.tsx 8.33% 0% 0% 8.33% 16-80
plugins/sanity-plugin-media/src/components/DialogFolderCreate/index.tsx 5.26% 0% 0% 6.25% 26-106
plugins/sanity-plugin-media/src/components/DialogTagCreate/index.tsx 100% 100% 100% 100%
plugins/sanity-plugin-media/src/components/DialogTagEdit/index.tsx 77.5% 52% 90% 76.92% 69, 88, 101-106, 114-116, 123, 137
plugins/sanity-plugin-media/src/components/TagsVirtualized/index.tsx 6.25% 0% 0% 6.66% 15-30, 36, 40-137
plugins/sanity-plugin-media/src/styled/react-select/creatable.tsx 50% 18.75% 36.84% 51.35% 17, 49-87, 113-118, 124, 127-145, 149-154, 159-162, 167-175
plugins/sanity-plugin-media/src/styled/react-select/single.tsx 28.57% 0% 0% 29.41% 17-91, 96-108, 113-118, 124, 127-145, 149, 153-162, 167-172
plugins/sanity-plugin-mux-input/src/components/ErrorBoundaryCard.tsx 0% 0% 0% 0% 15-96
Generated in workflow #8544 for commit c39d34e by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants