Fork me on GitHub
#om-next
<
2016-03-01
>
lgastako08:03:25

Can anyone tell me why I get "No queries exist for component path (mx.core/MainView mx.core/NavView)”) if I just pass all props to nav-view at line 53 (i.e. (nav-view (om/props this)) instead of pulling out the current tab and passing it in as I’ve done? https://www.refheap.com/115387#L-53

cmcfarlen15:03:30

@lgastako: The props returned from om/props contains metadata that has the path from the root that lead to the component. Queries also contain metadata that refers back to the component and is used to create the path. Since your MainView query doesn't refer to NavView's query, then the reconciler can't work the query backward to do the indexing. Pulling the props out and creating a new map elides the metadata and so om doesn't try to reconcile the query backward.

cmcfarlen15:03:15

@lgastako: disclaimer, that response includes a lot of guessing and conjecture

lgastako19:03:59

@cmcfarlen: thanks… that makes sense at a high level, but what would I need to do to refer to NavView’s query in MainView so that it could work the query backwards? Both views already use the same query?

cmcfarlen21:03:07

Since the query is the same, perhaps just have MainView and create a function that just returns the sablono vector and pass it the props. Then not have the NavViews component.

cmcfarlen21:03:47

If you want it to be a component, you can nest the query: [{:nav (om/get-query NavView)}]

lgastako22:03:25

The example code was extracted from a more complicated case in real life, but I’ll meditate on this and see if I can work out the “right” way to do it for my case. Thanks again.