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)))))))
non union version
[:outliner]