From fe708e8a2133e8cd54530f41e5f00c570db7658f Mon Sep 17 00:00:00 2001 From: Snorre Eskeland Brekke Date: Fri, 10 Jan 2025 10:35:00 +0100 Subject: [PATCH] fix: ensures singleworkspace falls back to the name 'default' as expected in all contexts (#8228) --- .../sanity/src/core/config/__tests__/resolveConfig.test.ts | 3 ++- packages/sanity/src/core/config/prepareConfig.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/sanity/src/core/config/__tests__/resolveConfig.test.ts b/packages/sanity/src/core/config/__tests__/resolveConfig.test.ts index ec8e27faecc..eff10151d30 100644 --- a/packages/sanity/src/core/config/__tests__/resolveConfig.test.ts +++ b/packages/sanity/src/core/config/__tests__/resolveConfig.test.ts @@ -39,7 +39,8 @@ describe('resolveConfig', () => { const [workspace] = await firstValueFrom( resolveConfig({ - name: 'default', + //the default name should be 'default', in both the workspace and the unstable_sources + //name: 'default', dataset, projectId, auth: createMockAuthStore({client, currentUser: null}), diff --git a/packages/sanity/src/core/config/prepareConfig.tsx b/packages/sanity/src/core/config/prepareConfig.tsx index e04c866605f..a85c9d74cc5 100644 --- a/packages/sanity/src/core/config/prepareConfig.tsx +++ b/packages/sanity/src/core/config/prepareConfig.tsx @@ -103,7 +103,7 @@ export function prepareConfig( const rootPath = getRootPath(options?.basePath) const workspaceOptions: WorkspaceOptions[] | [SingleWorkspace] = Array.isArray(config) ? config - : [config] + : [{...config, name: config.name ?? 'default'}] try { validateWorkspaces({workspaces: workspaceOptions})