From a57833f3cd99035f7d4173fe17a3bb284453cabe Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 2 Jun 2026 17:22:39 +0200 Subject: [PATCH] :bug: Fix get-comment-threads called with empty params due to race condition (#9988) Prevent navigate-to-comment-id from making an RPC call with nil file-id when current-file-id has been cleared by finalize-workspace during rapid workspace navigation. The deferred stream observer (rx/observe-on :async) could fire after the workspace state was already cleaned up, causing {:file-id nil} to become {} after query-string nil-filtering in map->query-string. Signed-off-by: Andrey Antukh --- frontend/src/app/main/data/workspace/comments.cljs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/data/workspace/comments.cljs b/frontend/src/app/main/data/workspace/comments.cljs index 71601e7b8a..a617753fa3 100644 --- a/frontend/src/app/main/data/workspace/comments.cljs +++ b/frontend/src/app/main/data/workspace/comments.cljs @@ -274,7 +274,8 @@ (ptk/reify ::navigate-to-comment-id ptk/WatchEvent (watch [_ state _] - (let [file-id (:current-file-id state)] + (if-let [file-id (:current-file-id state)] (->> (rp/cmd! :get-comment-threads {:file-id file-id}) (rx/map #(d/seek (fn [{:keys [id]}] (= thread-id id)) %)) - (rx/map navigate-to-comment)))))) + (rx/map navigate-to-comment)) + (rx/empty)))))