mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
♻️ Refactor state locality
The main purpose of this refactor is reduce a custom state from different pages and unify them under common access patterns
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
[app.common.files.helpers :as cfh]
|
||||
[app.common.types.container :as ctn]
|
||||
[app.common.types.file :as ctf]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.data.helpers :as dsh]
|
||||
[cljs.test :as t :include-macros true]
|
||||
[frontend-tests.helpers.pages :as thp]))
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
root-inst (ctn/get-shape page root-inst-id)
|
||||
main-instance? (:main-instance root-inst)
|
||||
|
||||
libs (wsh/get-libraries state)
|
||||
libs (dsh/lookup-libraries state)
|
||||
component (ctf/get-component libs (:component-file root-inst) (:component-id root-inst))
|
||||
library (ctf/get-component-library libs root-inst)
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
(let [page (thp/current-page state)
|
||||
root-inst (ctn/get-shape page root-inst-id)
|
||||
|
||||
libs (wsh/get-libraries state)
|
||||
libs (dsh/lookup-libraries state)
|
||||
component (ctf/get-component libs (:component-file root-inst) (:component-id root-inst))
|
||||
library (ctf/get-component-library libs root-inst)
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
(defn resolve-component
|
||||
"Get the component with the given id and all its shapes."
|
||||
[state component-file component-id]
|
||||
(let [libs (wsh/get-libraries state)
|
||||
(let [libs (dsh/lookup-libraries state)
|
||||
component (ctf/get-component libs component-file component-id)
|
||||
library (ctf/get-component-library libs component)
|
||||
shapes-main (ctf/get-component-shapes (:data library) component)]
|
||||
|
||||
Reference in New Issue
Block a user