mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 09:08:31 -05:00
🐛 Fix retrieve unread comment threads extra calls
This commit is contained in:
parent
9a60ac477f
commit
1aa7960863
2 changed files with 7 additions and 7 deletions
|
@ -322,7 +322,7 @@
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(rx/of (partial fetched-comments comments))
|
(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/merge-map #(rp/cmd! :get-profiles-for-file-comments {:file-id %}))
|
||||||
(rx/reduce #(merge %1 (d/index-by :id %2)) {})
|
(rx/reduce #(merge %1 (d/index-by :id %2)) {})
|
||||||
(rx/map #(partial fetched-users %))))))
|
(rx/map #(partial fetched-users %))))))
|
||||||
|
|
|
@ -22,17 +22,12 @@
|
||||||
|
|
||||||
(mf/defc comments-section
|
(mf/defc comments-section
|
||||||
[{:keys [profile team]}]
|
[{: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)
|
(let [show-dropdown? (mf/use-state false)
|
||||||
show-dropdown (mf/use-fn #(reset! show-dropdown? true))
|
show-dropdown (mf/use-fn #(reset! show-dropdown? true))
|
||||||
hide-dropdown (mf/use-fn #(reset! show-dropdown? false))
|
hide-dropdown (mf/use-fn #(reset! show-dropdown? false))
|
||||||
threads-map (mf/deref refs/comment-threads)
|
threads-map (mf/deref refs/comment-threads)
|
||||||
users (mf/deref refs/current-team-comments-users)
|
users (mf/deref refs/current-team-comments-users)
|
||||||
|
team-id (:id team)
|
||||||
|
|
||||||
tgroups (->> (vals threads-map)
|
tgroups (->> (vals threads-map)
|
||||||
(sort-by :modified-at)
|
(sort-by :modified-at)
|
||||||
|
@ -46,6 +41,11 @@
|
||||||
(st/emit! (-> (dwcm/navigate thread)
|
(st/emit! (-> (dwcm/navigate thread)
|
||||||
(with-meta {::ev/origin "dashboard"})))))]
|
(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/use-effect
|
||||||
(mf/deps @show-dropdown?)
|
(mf/deps @show-dropdown?)
|
||||||
(fn []
|
(fn []
|
||||||
|
|
Loading…
Add table
Reference in a new issue