diff --git a/packages/sanity/src/core/studio/router/helpers.ts b/packages/sanity/src/core/studio/router/helpers.ts index 1893bd89a20..3e449961c65 100644 --- a/packages/sanity/src/core/studio/router/helpers.ts +++ b/packages/sanity/src/core/studio/router/helpers.ts @@ -5,7 +5,7 @@ import {isRecord} from '../../util/isRecord' import {type RouterEvent, type RouterStateEvent} from './types' import {getOrderedTools} from './util/getOrderedTools' -const WEIGHTED_CREATE_INTENT_PARAMS = ['template'] +const WEIGHTED_CREATE_INTENT_PARAMS = ['mode', 'template'] const WEIGHTED_EDIT_INTENT_PARAMS = ['mode'] function resolveUrlStateWithDefaultTool(tools: Tool[], state: Record | null) { diff --git a/packages/sanity/src/structure/structureTool.ts b/packages/sanity/src/structure/structureTool.ts index bc352d3cff3..9fa0a34992d 100644 --- a/packages/sanity/src/structure/structureTool.ts +++ b/packages/sanity/src/structure/structureTool.ts @@ -134,9 +134,14 @@ function canHandleCreateIntent(params: Record) { return false } - // We can handle any create intent as long as it has a `type` parameter, - // but we also know how to deal with templates, where other tools might not - return 'template' in params ? {template: true} : true + const handle: Record = {} + // We can handle any create intent as long as it has a `type` parameter + // but we are best at `structure` mode + if ('mode' in params) handle.mode = params.mode === 'structure' + // we also know how to deal with templates, where other tools might not + if ('template' in params) handle.template = true + + return Object.keys(handle).length ? handle : true } function canHandleEditIntent(params: Record) {