mirror of
https://github.com/penpot/penpot.git
synced 2025-06-19 22:01:37 +02:00
⚡ Reduce unnecesary lookups on get-frame-by-position fn
This commit is contained in:
parent
6b3fa31d68
commit
b7eb20dc44
5 changed files with 27 additions and 23 deletions
|
@ -83,7 +83,7 @@
|
|||
(watch [_ state _]
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (wsh/lookup-page-objects state page-id)
|
||||
frame-id (ctst/frame-id-by-position objects (:position params))
|
||||
frame-id (ctst/get-frame-id-by-position objects (:position params))
|
||||
params (assoc params :frame-id frame-id)]
|
||||
(->> (rp/cmd! :create-comment-thread params)
|
||||
(rx/mapcat #(rp/cmd! :get-comment-thread {:file-id (:file-id %) :id (:id %)}))
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
page-id (:id page)
|
||||
objects (wsh/lookup-page-objects state page-id)
|
||||
new-frame-id (if (nil? frame-id)
|
||||
(ctst/frame-id-by-position objects (gpt/point new-x new-y))
|
||||
(ctst/get-frame-id-by-position objects (gpt/point new-x new-y))
|
||||
(:frame-id thread))
|
||||
thread (assoc thread
|
||||
:position (gpt/point new-x new-y)
|
||||
|
|
|
@ -206,7 +206,7 @@
|
|||
from-frame-id (if (cph/frame-shape? from-shape)
|
||||
from-id (:frame-id from-shape))
|
||||
|
||||
target-frame (ctst/frame-by-position objects position)]
|
||||
target-frame (ctst/get-frame-by-position objects position)]
|
||||
|
||||
(when (and (not= (:id target-frame) uuid/zero)
|
||||
(not= (:id target-frame) from-frame-id))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue