I am building an om based form were subsections may be viewed either collapsed or expanded. The view status is saved in the subsections local state:
(defn subsection-view [subsection owner] (reify om/IInitState (init-state [this] {:collapsed true}))
The problem is that each subsections view status can be effected both ways either by the collapse-expand-all button or by a separate button displayed for each subsection.
In order to handle expand-compress-all there is a global collapse status saved in the form local state:
(defn form-view [data owner] (reify om/IInitState (init-state [this] {:all-collapsed true})))
Obviously both buttons on-click
events are handled by updating the collapse status in the local state.
(om/update-state! owner :collapsed not)
My question is how should I know which status was updated last in order to display the right view?
Or where is the right place (local state or application state) to save the collapse status that might be effected from different triggers in different levels of the component tree?