0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-27 00:49:28 -05:00

Merge pull request #3447 from penpot/superalex-fix-retrieve-unread-comment-threads-extra-calls

🐛 Fix retrieve unread comment threads extra calls
This commit is contained in:
Alejandro 2023-07-25 14:56:21 +02:00 committed by GitHub
commit b460a8f64e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -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 %))))))

View file

@ -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 []