My application interface is a set of generic panels that can be configured to display components via a :view
prop. The views correspond to components that have a top level query. There could be 0-n
instances of a component.
The panels themselves are normalized in the app-state:
{:panels/by-id {
0 {:id 0 :view :outliner}
1 {:id 0 :view :menu}
2 {:id 0 :view :selection}
3 {:id 0 :view :selection}}
:panels [
[:panels/by-id 0]
[:panels/by-id 1]
[:panels/by-id 2]
[:panels/by-id 3]]}
I attempted to use a union
query. My read fn is correctly pulling values for the union map, but subcomponent omcljs$path
is nil
. (guessing because :data
is imaginary and perhaps the union query results should be under each :panels value)
(defui Main
static om/IQuery
(query [this]
`[{:panels [:id :view]}
{:data
~{:outliner (om/get-query Outliner)
:selection (om/get-query Selection)
:menubar (om/get-query Menubar)
:query (om/get-query Query)}}])
Object
(render [this]
(let [props (om/props this)]
(html
(map
(fn [{:keys [view id]}]
(dom/div #js {:key id}
((comp/onent view) ;kw->factory
(get (:data props) view) )))
(:panels props)))))))
starting to focus updates
Re implementing selection updates from the om.prev version. The outliner gets very large with document size, and had very specific updates. The outliner nodes ident to
:uid->token
which has a selection prop synced to the:selection/uids
set. (also stores expansion, editing lock, visibility, and workspace mouse targeting booleans.)I was having issues focusing updates for recursive components, so the outliner is getting a flat list of nodes with a
:depth
prop. Perhaps it should be a tree of recursive:uid :children
nodes that render a token subcomponent.general performance
om/issues/556 is no joke!
bootstrap.html parses to 1700 entries, and it's taking ~700ms just to transact the selection.
In lieu of transactions getting faster I'm going to limit the amount of data in the om atom. Finalpage has it's own normalized datatypes and protocols, and it's easier to compose when not cast as [:by-id 7] idents.
uid
s can be cast to edn during read or render, and complex data (like the style selection to{rule {uid value}}
map can be cached on selection update.Other data that can be externalized