diff --git a/frontend/src/app/main/data/comments.cljs b/frontend/src/app/main/data/comments.cljs index 225ddae8b..46bf3c752 100644 --- a/frontend/src/app/main/data/comments.cljs +++ b/frontend/src/app/main/data/comments.cljs @@ -322,7 +322,7 @@ (rx/concat (rx/of (partial fetched-comments comments)) - (->> (rx/from (map :file-id comments)) + (->> (rx/from (into #{} (map :file-id) comments)) (rx/merge-map #(rp/cmd! :get-profiles-for-file-comments {:file-id %})) (rx/reduce #(merge %1 (d/index-by :id %2)) {}) (rx/map #(partial fetched-users %)))))) diff --git a/frontend/src/app/main/ui/dashboard/comments.cljs b/frontend/src/app/main/ui/dashboard/comments.cljs index 2da270779..dc92961dd 100644 --- a/frontend/src/app/main/ui/dashboard/comments.cljs +++ b/frontend/src/app/main/ui/dashboard/comments.cljs @@ -22,17 +22,12 @@ (mf/defc comments-section [{:keys [profile team]}] - - (mf/use-effect - (mf/deps team) - (fn [] - (st/emit! (dcm/retrieve-unread-comment-threads (:id team))))) - (let [show-dropdown? (mf/use-state false) show-dropdown (mf/use-fn #(reset! show-dropdown? true)) hide-dropdown (mf/use-fn #(reset! show-dropdown? false)) threads-map (mf/deref refs/comment-threads) users (mf/deref refs/current-team-comments-users) + team-id (:id team) tgroups (->> (vals threads-map) (sort-by :modified-at) @@ -46,6 +41,11 @@ (st/emit! (-> (dwcm/navigate thread) (with-meta {::ev/origin "dashboard"})))))] + (mf/use-effect + (mf/deps team-id) + (fn [] + (st/emit! (dcm/retrieve-unread-comment-threads team-id)))) + (mf/use-effect (mf/deps @show-dropdown?) (fn []