From 73bfc0dc15ce07b3c025361d35b2dea7d332a556 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 22 Jul 2026 09:00:43 +0200 Subject: [PATCH] :bug: Guard workspace-page* when file-id is not a uuid (#10655) The workspace route can be reached without a `:file-id` query parameter (e.g. `/#/workspace?team-id=...`). When that happened, `workspace*` was emitting `dw/initialize-workspace` with a nil file-id, which stored nil in `:current-file-id`. The `fetch-profiles` event then read nil from state and called `:get-profiles-for-file-comments` with `{:file-id nil}`, producing a 400 response. Move the `use-equal-memo` calls for `file-id` and `page-id` from `workspace*` up to `workspace-page*`, and guard the render with `(when (uuid? file-id) ...)` so `workspace*` only mounts when `file-id` is a valid uuid. Since `workspace*` never mounts with a nil `file-id`, `initialize-workspace` is never emitted with nil, and the 400 is prevented at the source. AI-assisted-by: minimax-m3 --- frontend/src/app/main/ui/workspace.cljs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/main/ui/workspace.cljs b/frontend/src/app/main/ui/workspace.cljs index bb69485774..e7a3e7b119 100644 --- a/frontend/src/app/main/ui/workspace.cljs +++ b/frontend/src/app/main/ui/workspace.cljs @@ -196,10 +196,7 @@ {::mf/wrap [mf/memo]} [{:keys [team-id project-id file-id page-id layout-name]}] - (let [file-id (hooks/use-equal-memo file-id) - page-id (hooks/use-equal-memo page-id) - - layout (mf/deref refs/workspace-layout) + (let [layout (mf/deref refs/workspace-layout) wglobal (mf/deref refs/workspace-global) team-ref (mf/with-memo [team-id] @@ -287,6 +284,12 @@ (mf/defc workspace-page* {::mf/lazy-load true} - [props] - [:> workspace* props]) + [{:keys [file-id page-id] :as props}] + (let [file-id (hooks/use-equal-memo file-id) + page-id (hooks/use-equal-memo page-id) + props (mf/spread-props props {:file-id file-id + :page-id page-id})] + + (when (uuid? file-id) + [:> workspace* props])))