mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 18:16:12 +02:00
⚡ Avoid double id lookup when calling lookup-page-objects (#6513)
This commit is contained in:
parent
71bb2556f9
commit
fd89c9d82c
3 changed files with 11 additions and 10 deletions
|
@ -395,7 +395,7 @@
|
|||
(watch [it state _]
|
||||
(let [file-id (:current-file-id state)
|
||||
page-id (:current-page-id state)
|
||||
objects (dsh/lookup-page-objects state page-id)
|
||||
objects (dsh/lookup-page-objects state file-id page-id)
|
||||
shapes (dwg/shapes-for-grouping objects selected)
|
||||
parents (into #{} (map :parent-id) shapes)]
|
||||
(when-not (empty? shapes)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
(ns app.main.data.workspace.path.changes
|
||||
(:require
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.files.changes-builder :as pcb]
|
||||
[app.common.types.path :as path]
|
||||
[app.main.data.changes :as dch]
|
||||
|
@ -74,10 +75,10 @@
|
|||
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(let [objects (dsh/lookup-page-objects state)
|
||||
page-id (:current-page-id state)
|
||||
id (get-in state [:workspace-local :edition])
|
||||
old-content (get-in state [:workspace-local :edit-path id :old-content])
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (dsh/lookup-page-objects state page-id)
|
||||
id (dm/get-in state [:workspace-local :edition])
|
||||
old-content (dm/get-in state [:workspace-local :edit-path id :old-content])
|
||||
shape (st/get-path state)]
|
||||
|
||||
(if (and (some? old-content) (some? (:id shape)))
|
||||
|
|
|
@ -332,11 +332,11 @@
|
|||
(ptk/reify ::select-shapes-by-current-selrect
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (dsh/lookup-page-objects state)
|
||||
selrect (dm/get-in state [:workspace-local :selrect])
|
||||
blocked? (fn [id] (dm/get-in objects [id :blocked] false))
|
||||
ask-worker (if buffered? mw/ask-buffered! mw/ask!)
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (dsh/lookup-page-objects state page-id)
|
||||
selrect (dm/get-in state [:workspace-local :selrect])
|
||||
blocked? (fn [id] (dm/get-in objects [id :blocked] false))
|
||||
ask-worker (if buffered? mw/ask-buffered! mw/ask!)
|
||||
filter-objs (comp
|
||||
(filter (complement blocked?))
|
||||
(remove (partial cfh/hidden-parent? objects)))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue