Skip to content

refactor: extract emptyAuth object to avoid duplication in getStudioWorkspaces#1240

Merged
bjoerge merged 1 commit into
mainfrom
issue-12952-auth-divergence
Jun 10, 2026
Merged

refactor: extract emptyAuth object to avoid duplication in getStudioWorkspaces#1240
bjoerge merged 1 commit into
mainfrom
issue-12952-auth-divergence

Conversation

@bjoerge

@bjoerge bjoerge commented Jun 10, 2026

Copy link
Copy Markdown
Member

Description

Should fix #1239

What to review

Testing

@bjoerge bjoerge requested a review from a team as a code owner June 10, 2026 15:47
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Stats — Calculating bundle sizes for @sanity/cli, @sanity/cli-core, create-sanity...

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the CLI’s Studio workspace resolution (getStudioWorkspaces) to reuse a single shared “empty auth” store across all workspaces, preventing Sanity’s auth-divergence warning from firing due to per-workspace stub auth objects being different references (as described in #1239).

Changes:

  • Extracted a shared emptyAuth object and reused it for all unauthedWorkspaces
  • Avoided creating one empty auth store (and empty client) per workspace during resolveConfig() input preparation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Delta

File Statements
packages/@sanity/cli-core/src/config/studio/getStudioWorkspaces.ts 4.0% (- 0.2%)

Comparing 1 changed file against main @ 3370e9504e36229ada9553cd541071223afb53db

Overall Coverage

Metric Coverage
Statements 80.3% (- 0.6%)
Branches 71.8% (- 0.6%)
Functions 79.0% (- 1.4%)
Lines 80.8% (- 0.6%)

@bjoerge bjoerge merged commit b3cbdb0 into main Jun 10, 2026
52 checks passed
@bjoerge bjoerge deleted the issue-12952-auth-divergence branch June 10, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workspaces auth-divergence warning fires even when auth is shared by reference (CLI cloning)

3 participants