Avoid double id lookup when calling lookup-page-objects (#6513)

This commit is contained in:
Miguel de Benito Delgado 2025-05-20 22:31:40 +02:00 committed by GitHub
parent 71bb2556f9
commit fd89c9d82c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 10 deletions

View file

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

View file

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

View file

@ -333,7 +333,7 @@
ptk/WatchEvent
(watch [_ state _]
(let [page-id (:current-page-id state)
objects (dsh/lookup-page-objects 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!)