Fork me on GitHub
#om
<
2016-07-06
>
cmcfarlen14:07:33

@anmonteiro: I ran into another issue that I think is compassus related. I was able to reproduce it in a small(ish) example, although in the example it doesn't present in quite the same way.

cmcfarlen15:07:39

#error {:message "No queries exist for component path (compassus.core/ui_24151 route-params.core/ItemDetailsPage route-params.core/Item)", :data {:type :om.next/no-queries}}
cljs$core$IFn$_invoke$arity$2next.cljs:1286:89
om$next$full_querynext.cljs:1255
cljs$core$IFn$_invoke$arity$1next.cljs:1265
om$next$full_querynext.cljs:1255
om$next$default_ui__GT_propsnext.cljs:1802
om$next$protocols$IReconciler$reconcile_BANG_$arity$1next.cljs:1777
om$next$protocols$reconcile_BANG_protocols.cljc:11
fnext.cljs:834

anmonteiro15:07:49

@cmcfarlen: got it running, how should I repro?

cmcfarlen15:07:33

If you have figwheel reload the js it will fail

anmonteiro15:07:57

then not an issue at all 馃檪

cmcfarlen15:07:57

So just open and save the source file. But that isn't necessary in my app. I'm not sure the difference

cmcfarlen15:07:22

In my app it get into the same state if you load the details page directly

anmonteiro15:07:40

if it鈥檚 a reloading issue, that鈥檚 not a bug

anmonteiro15:07:49

I鈥檝e seen that same stacktrace with plain Om too

anmonteiro15:07:55

after a figwheel reload

anmonteiro15:07:12

you have to write reloadable code if you want that to work with Figwheel

cmcfarlen15:07:27

I understand. I'll try to repro without the reloading part

anmonteiro15:07:30

otherwise you鈥檒l have to hard refresh the browser

cmcfarlen15:07:25

In my app, if I point the browser to "/item/3" then I get the error, but if I load the list and click a link it works fine.

anmonteiro15:07:42

that does sound like a bug then

anmonteiro15:07:54

I wonder how we could go about reproducing that

cmcfarlen15:07:54

I noticed that when its working, the om/path to the component that complains is [::compassus/route-data :item], but when it fails it is [:item-details :item]

cmcfarlen15:07:53

So the route key is part of the path instead of the union key in the compassus generated component

anmonteiro15:07:30

I think ::compassus/route-data should be part of the path

anmonteiro15:07:36

if that鈥檚 what you鈥檙e saying

cmcfarlen15:07:45

right, that has been my experience

anmonteiro15:07:12

can you repro this behavior in the example you linked?

cmcfarlen15:07:13

The exception is raised during a reconcile! after a transaction

cmcfarlen15:07:32

No, I can't. As I said its slightly different 馃槥

cmcfarlen15:07:03

I'll go back and compare to make sure the example is representative of my app

anmonteiro15:07:25

might it be because there鈥檚 no server involved here?

cmcfarlen15:07:55

Perhaps. I have to go back to the server to load some related data on the focused item, but I use data in the item to do the second load. I thought maybe that was the issue, but I'm not sure anymore

cmcfarlen15:07:12

@anmonteiro: If I ensure the app is only mounted once, then of course this example doesn't break on reload. The same doesn't fix my app however as it fails on the first load. I'll keep looking and let you know what I find out.

anmonteiro15:07:44

@cmcfarlen: right, makes total sense

anmonteiro15:07:06

Alright, I鈥檒l wait for the repro, thanks!

cmcfarlen15:07:55

This is a kinda cool example of using compassus with bidi/pushy and remote reads though. So we have that going for us, which is nice.

anmonteiro15:07:41

@cmcfarlen: that鈥檚 awesome news

anmonteiro15:07:10

happy to link to your app in the Compassus README if it鈥檚 something public or open source

cmcfarlen15:07:45

That would be fine with me. I made it to demo that issue, so totally public

peeja16:07:55

Is getInitialState the correct way to set a component's initial state in Om (next)?

peeja16:07:58

Looks like I'm looking for initLocalState. Is that right?

cjmurphy17:07:33

@peeja: Yes. Goes underneath Object in your component (just like render). And takes this as first arg like all the others under Object.

cjmurphy17:07:49

(initLocalState [this]
    {:last-time-auth? false})

cmcfarlen18:07:19

@anmonteiro: I was finally able to reproduce my error. If the local-read for the :related returns nil or {:value nil} then the error happens.

hlolli19:07:29

when I send mutation to om.next.server, I always get returned the name of the mutation method with a map. Is there a way to handle the merge into the app state in such a way that the mutation method doesnt become a key?

denik21:07:20

Are query-less components going to be able to transact soon? We鈥檙e running into perf issues because parent-components have such large queries. Or is there a way to not implicitly include the rereads for the entire query of the transacting component?

jasonjckn21:07:08

if I transact! on the reconciler, and don't include any keys in the query expression, is nothing rerendered? even if in the mutation I update app

ethangracer21:07:55

@denik did you hear that transact will support query-less components? why do you want to modify the app-state but not query for the new state? Om wouldn鈥檛 re-render your app because it didn鈥檛 re-query the state, so I鈥檓 not understanding why you want to transact from a queryless component

ethangracer21:07:59

@jasonjckn: the whole app is re-rendered if you transact on the reconciler, from what I understand

jasonjckn22:07:05

@ethangracer: ok i think i'm observing that

jasonjckn22:07:18

@ethangracer: so including keys in the query expression is only relevant if I transact on a component

jasonjckn22:07:37

@ethangracer: do they have to be root keys, keys found in subqueries?

ethangracer22:07:52

yes, follow-on reads only apply if you want to re-render something that isn鈥檛 a child of the component that calls transact

ethangracer22:07:04

they can be any key found in the query, or any ident

ethangracer22:07:31

yeah! super handy

jasonjckn22:07:44

what does om/merge! do for rerendering?

ethangracer22:07:12

good question

ethangracer22:07:16

i鈥檇 have to look at the code

jasonjckn22:07:27

hm ok, no sweat

ethangracer22:07:34

it gets a query so I imagine it may try to use that

ethangracer22:07:42

then again ,that data might not be on screen yet

ethangracer22:07:51

rather, the components that use the data being merged

ethangracer22:07:05

in which case the indexer wouldn鈥檛 know what components to re-render

ethangracer22:07:39

so it probably re-renders from the reconciler, possibly specific components if it can find them in the indexer. that would be my best guess without verifying in the codebase

jasonjckn22:07:39

docs say ""Merge a state delta into the application state. Affected components managed by the reconciler will re-render.""