♻️ 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:
Andrey Antukh 2025-01-16 11:00:14 +01:00
parent f62aecb383
commit 85746e7cb2
110 changed files with 2254 additions and 2125 deletions

View file

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