From ee2054f3338893df33df02f021ec20fb4cfbeec7 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Fri, 30 Jan 2026 06:37:10 -0500 Subject: [PATCH] fix: 'New draft' from command menu leads to 'Not found' (#11316) --- app/scenes/DocumentNew.tsx | 3 ++- app/utils/routeHelpers.ts | 17 +++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/scenes/DocumentNew.tsx b/app/scenes/DocumentNew.tsx index 04669154d8..a5fce7543b 100644 --- a/app/scenes/DocumentNew.tsx +++ b/app/scenes/DocumentNew.tsx @@ -79,7 +79,8 @@ function DocumentNew({ template }: Props) { } void createDocument(); - }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); return ( diff --git a/app/utils/routeHelpers.ts b/app/utils/routeHelpers.ts index f5c633cc58..6a4459c9c4 100644 --- a/app/utils/routeHelpers.ts +++ b/app/utils/routeHelpers.ts @@ -113,13 +113,19 @@ export function newDocumentPath( templateId?: string; } = {} ): string { + const search = queryString.stringify(params); + return collectionId - ? `/collection/${collectionId}/new?${queryString.stringify(params)}` - : `/doc/new?${queryString.stringify(params)}`; + ? `/collection/${collectionId}/new${search ? `?${search}` : ""}` + : `/doc/new${search ? `?${search}` : ""}`; } export function newNestedDocumentPath(parentDocumentId?: string): string { - return `/doc/new?${queryString.stringify({ parentDocumentId })}`; + const search = parentDocumentId + ? `?${queryString.stringify({ parentDocumentId })}` + : ""; + + return `/doc/new${search}`; } export function searchPath({ @@ -133,15 +139,14 @@ export function searchPath({ documentId?: string; ref?: string; } = {}): string { - let search = queryString.stringify({ + const search = queryString.stringify({ q: query, collectionId, documentId, ref, }); - search = search ? `?${search}` : ""; - return `/search${search}`; + return `/search${search ? `?${search}` : ""}`; } export function sharedModelPath(shareId: string, modelPath?: string) {