Skip to content

fix(structure): suppress deprecated selectedVariantName lint error in useListPaneCounts - #15061

Merged
stipsan merged 1 commit into
mainfrom
cody/suppress-deprecated-selected-variant-name-1bc3
Sep 28, 2026
Merged

stipsan merged 1 commit into
mainfrom
cody/suppress-deprecated-selected-variant-name-1bc3

Conversation

@stipsan

@stipsan stipsan commented Sep 28, 2026

Copy link
Copy Markdown
Member

Description

Alternative to #15059. The Should the linter fix? 🤔 job fails on main because useListPaneCounts destructures the deprecated selectedVariantName field from usePerspective(), tripping typescript/no-deprecated:

packages/sanity/src/structure/panes/list/useListPaneCounts.ts:130:28: error typescript(no-deprecated): `selectedVariantName` is deprecated. Use `selectedVariantNames`. This is the first selected id.

Instead of refactoring the hook (and its test mocks) to selectedVariantNames + getDefaultVariant, this adds a single-line suppression:

// oxlint-disable-next-line no-deprecated -- will fix in follow up PR
const {perspectiveStack, selectedVariantName} = usePerspective()

This matches the existing precedent for the same deprecation elsewhere in src/structure (StructureToolProvider.tsx, createPaneResolver.ts, ParameterizedLink.tsx, DocumentActionsProvider.tsx, PaneHeaderActions.tsx), so the migration off selectedVariantName can happen in one sweep rather than piecemeal. No runtime behavior or test changes.

What to review

  • The one-line change in packages/sanity/src/structure/panes/list/useListPaneCounts.ts.

Testing

  • oxlint --disable-nested-config packages/sanity/src/structure/panes/list/useListPaneCounts.ts: reports the no-deprecated error on main, exits 0 with this change.
  • oxfmt --check on the file passes.
  • pnpm vitest run --project=sanity packages/sanity/src/structure/panes/list/useListPaneCounts.test.tsx: 9/9 pass, no type errors.

Notes for release

N/A: Internal only (lint suppression)


Open in Web Open in Cursor 

Copilot AI balanced review requested due to automatic review settings September 28, 2026 13:30
@stipsan stipsan added the 🤖 bot label Sep 28, 2026 — with Cursor
@vercel

vercel Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
auth-test-studio Ready Ready Preview Sep 28, 2026 1:32pm UTC
page-building-studio Ready Ready Preview Sep 28, 2026 1:32pm UTC
studio-diagnostics Ready Ready Preview Sep 28, 2026 1:32pm UTC
studio-radar Ready Ready Preview Sep 28, 2026 1:32pm UTC
studio-storybook Ready Ready Preview Sep 28, 2026 1:32pm UTC
test-studio Ready Ready Preview Sep 28, 2026 1:32pm UTC
test-studio-preview-iframe Ready Ready Preview Sep 28, 2026 1:32pm UTC

Request Review

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Stats — sanity

Compared against main (f5821c33) · v6.16.0 (npm)

sanity

Metric Value vs main (f5821c3) vs v6.16.0
Internal (raw) 4.48 MB - +45.5 KB, +1.0%
Internal (gzip) 1.11 MB - +17.0 KB, +1.5%
Bundled (raw) 13.32 MB - +64.4 KB, +0.5%
Bundled (gzip) 3.16 MB - +21.3 KB, +0.7%
Import time 1.76s -17ms, -0.9% +20ms, +1.2%

bin:sanity

Metric Value vs main (f5821c3) vs v6.16.0
Internal (raw) 7.1 KB - -
Internal (gzip) 2.9 KB - -
Bundled (raw) 7.1 KB - -
Bundled (gzip) 2.8 KB - -
Import time 5ms -0ms, -2.2% +0ms, +2.4%

🗺️ View treemap · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

❌ E2E Tests

🟢 212 passed • 🔴 1 failed • 🟡 4 flaky • (⚪ 93 skipped) • view full report • view run

🤖 Share with an AI agent:

Fix the failing e2e tests. The failure report with error messages and page snapshots is at https://e2e-studio-8qes2mb21.sanity.dev/agent-report.md
Debug failing tests locally
SANITY_E2E_PROJECT_ID=ittbm412 \
SANITY_E2E_BASE_URL=https://e2e-studio-9b8v5w7ag.sanity.dev \
SANITY_E2E_DATASET=pr-15061-chromium-36429092765 \
SANITY_E2E_DATASET_CHROMIUM=pr-15061-chromium-36429092765 \
SANITY_E2E_DATASET_FIREFOX=pr-15061-firefox-36429092765 \
pnpm test:e2e --headed \
  e2e/tests/default-layout/versionStatus.spec.ts

Studio: https://e2e-studio-9b8v5w7ag.sanity.dev

@github-actions

Copy link
Copy Markdown
Contributor

📚 TypeDoc Generation Result

✅ TypeDoc generated successfully!

  • File size: 8.7M
  • Total exports: 1106
  • Artifact: sanity-typedoc-9a558c77675dc7541c7f2053c632000e7aef0d75

The TypeDoc JSON file has been generated and validated. All documentation scripts completed successfully.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The deprecated API has a straightforward supported replacement and should be migrated rather than suppressed.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds a lint suppression for deprecated perspective API usage in list-pane counts.

Changes:

  • Suppresses the selectedVariantName deprecation warning.
File Description
packages/​sanity/​src/​structure/​panes/​list/​useListPaneCounts.ts Adds the lint suppression.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

enabled = true,
): ListPaneCounts {
const documentPreviewStore = useDocumentPreviewStore()
// oxlint-disable-next-line no-deprecated -- will fix in follow up PR
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 50.08% 40689 / 81239
🔵 Statements 45.36% 54082 / 119211
🔵 Functions 45.48% 8323 / 18299
🔵 Branches 40.39% 31253 / 77369
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/structure/panes/list/useListPaneCounts.ts 97.01% 96.87% 91.66% 97.82% 95, 143
Generated in workflow #72362 for commit 8b6041c by the Vitest Coverage Report Action

@stipsan
stipsan marked this pull request as ready for review September 28, 2026 13:43
@stipsan
stipsan requested a review from a team as a code owner September 28, 2026 13:43
@stipsan
stipsan requested review from pedrobonamin and removed request for a team September 28, 2026 13:43
@stipsan
stipsan merged commit 30dcbdf into main Sep 28, 2026
102 of 108 checks passed
@stipsan
stipsan deleted the cody/suppress-deprecated-selected-variant-name-1bc3 branch September 28, 2026 13:43

This branch was successfully deployed

7 active deployments
Preview – studio-diagnostics — 8b6041cc Deployed Sep 28, 2026 by vercel[bot]
Preview – studio-storybook — 8b6041cc Deployed Sep 28, 2026 by vercel[bot]
Preview – page-building-studio — 8b6041cc Deployed Sep 28, 2026 by vercel[bot]
Preview – test-studio — 8b6041cc Deployed Sep 28, 2026 by vercel[bot]
Preview – studio-radar — 8b6041cc Deployed Sep 28, 2026 by vercel[bot]
Preview – auth-test-studio — 8b6041cc Deployed Sep 28, 2026 by vercel[bot]
Preview – test-studio-preview-iframe — 8b6041cc Deployed Sep 28, 2026 by vercel[bot]
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.

3 participants