From eb1e0ad186fce7b7c30d3ee5fe556413fa0369e1 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 22 Jul 2026 16:57:46 +0200 Subject: [PATCH] :bug: Guard team-container* when team-id is not a uuid (#10645) The dashboard route can be reached without a `:team-id` query parameter (e.g. `/#/dashboard/recent`). When that happened, `team-container*` was emitting `dtm/initialize-team` with a `nil` team-id, which set `:current-team-id` to `nil` in the application state. The dashboard and workspace initialize events then built `df/fetch-fonts` with a `nil` team-id, producing a `:get-font-variants` RPC with empty params `{}` that the backend rejected with HTTP 400. Guard `team-container*` so it does not emit `initialize-team` / `finalize-team` and does not render the children when `team-id` is not a uuid. The `with-effect` body and the render are guarded independently; the cleanup closure captures the same `team-id` as the setup, so the finalize still fires correctly when transitioning between valid teams. AI-assisted-by: minimax-m3 --- frontend/src/app/main/ui.cljs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/main/ui.cljs b/frontend/src/app/main/ui.cljs index 157ae24d9b..f41242f6f6 100644 --- a/frontend/src/app/main/ui.cljs +++ b/frontend/src/app/main/ui.cljs @@ -133,18 +133,21 @@ ::mf/private true} [{:keys [team-id children]}] (mf/with-effect [team-id] - (st/emit! (dtm/initialize-team team-id)) - (fn [] - (st/emit! (dtm/finalize-team team-id)))) + (when (uuid? team-id) + (st/emit! (dtm/initialize-team team-id)) + (fn [] + (st/emit! (dtm/finalize-team team-id))))) - (let [{:keys [permissions] :as team} (mf/deref refs/team)] - (when (= team-id (:id team)) - [:> (mf/provider ctx/current-team-id) {:value team-id} - [:> (mf/provider ctx/permissions) {:value permissions} - [:> (mf/provider ctx/can-edit?) {:value (:can-edit permissions)} - ;; The `:key` is mandatory here because we want to reinitialize - ;; all dom tree instead of simple rerender. - [:* {:key (str team-id)} children]]]]))) + (if-not (uuid? team-id) + nil + (let [{:keys [permissions] :as team} (mf/deref refs/team)] + (when (= team-id (:id team)) + [:> (mf/provider ctx/current-team-id) {:value team-id} + [:> (mf/provider ctx/permissions) {:value permissions} + [:> (mf/provider ctx/can-edit?) {:value (:can-edit permissions)} + ;; The `:key` is mandatory here because we want to reinitialize + ;; all dom tree instead of simple rerender. + [:* {:key (str team-id)} children]]]])))) (mf/defc page* {::mf/props :obj