Fork me on GitHub
#om
<
2016-09-18
>
peeja01:09:51

Uh oh. Now I'm getting the dreaded error: No queries exist for component path (compassus.core/ui_32146 frontend.core/ProjectsPage frontend.core/OrgListItem) or data path [:compassus.core/route-data :app/current-user :user/organizations] It appears to be because the props have the path [:compassus.core/route-data :app/current-user :user/organizations], but the indexer has indexed the component as [:compassus.core/route-data [:app/current-user _] :user/organizations 0].

peeja01:09:31

I don't think my parser's doing anything wrong; the structure of its response is what comes out of db->tree

anmonteiro01:09:20

@peeja looks like a bug, but I thought we never constructed paths with links in the indexer

anmonteiro01:09:25

can you produce a minimal case?

peeja01:09:38

I can try

peeja01:09:01

The bug is that the indexer shouldn't have the link in its path?

anmonteiro01:09:04

but this one might not be that simple to figure out, can you open an issue?

peeja01:09:17

Sure. I've got a test written, too.

anmonteiro01:09:23

@peeja that test is supposed to fail

anmonteiro01:09:33

that’s not the bug

peeja01:09:50

Oh, then I'm misunderstanding what you were saying above

anmonteiro01:09:05

class-path != data-path

anmonteiro01:09:12

the query should contain the link

anmonteiro01:09:18

the data path maybe shouldn't

peeja01:09:53

Oh. Yeah. I'm not misunderstanding, I'm just writing the test wrong. 😛

anmonteiro01:09:45

but this is a tricky one

peeja01:09:35

Right, in other cases, it actually does match the query

peeja01:09:05

So…the issue is that full-query needs to be more sophisticated?

anmonteiro01:09:23

that’s probably right

anmonteiro01:09:31

this condition should probably flatten the links it finds

peeja01:09:58

Yeah, that makes sense to me

anmonteiro01:09:59

cljs.user=> (om/focus->path [{[:a '_] [{:foo [:b :c]}]}])
[[:a _] :foo]

anmonteiro01:09:09

this is probably right

anmonteiro01:09:14

that’s the actual path of the query

anmonteiro01:09:21

so for the tweak should happen in full-query

anmonteiro01:09:49

@peeja probably worth tweaking the issue title and description, seems a bit misleading now that we have this information

peeja01:09:04

Yeah, I'm trying to write a new test

anmonteiro01:09:23

BTW it’s really great you approaching all this from a new angle

peeja01:09:37

I'm glad I'm not just a pain in the butt 🙂

anmonteiro01:09:44

I appreciate we finding all these bugs before beta 🙂

peeja01:09:08

Huh, are there any tests that call full-query? I don't see any. Should the test be at a different level?

anmonteiro01:09:49

@peeja there are no tests for full-query, probably worth adding some

anmonteiro01:09:00

problem is that we need an assembled indexer to call it 🙂

peeja01:09:08

Yeah, I'm just noticing that 🙂

peeja01:09:14

Not just an indexer, but a reconciler

anmonteiro01:09:11

you can probably get away by using with-redefs for get-indexer

anmonteiro01:09:36

because you want to test at the point that we already have qs

anmonteiro01:09:40

that make sense?

peeja01:09:38

How do I instantiate a component here?

anmonteiro01:09:50

(Component. #js {:omcljs$reconciler r :omcljs$path [the path you want the component to have]})

anmonteiro01:09:19

@peeja and there’s a slightly different version for the :clj branch

anmonteiro01:09:31

you can find it in the test suite

peeja01:09:28

Ah, I see it now. Thanks.

peeja02:09:52

Okay, updated with correct info (as far as I know) and a test: https://github.com/omcljs/om/issues/773

anmonteiro14:09:25

@peeja try applying the commits on these 2 branches and see if your issues are gone: https://github.com/anmonteiro/om/tree/om-772 https://github.com/anmonteiro/om/tree/om-773

peeja17:09:12

@anmonteiro 773 works great for me. 772 still has one problem: if there's a component with that ident as its ident, and there's a component with the ident in its query, the logic short-circuits and fails to find the second one. Here's a version which finds both: https://github.com/Peeja/om/commit/23556d04f8bd1b1e62784c3aefef1b0b57226fae

anmonteiro18:09:20

@peeja yep, definitely an overlook. Thanks for the added test, I’ll use that to fix the PR

anmonteiro18:09:32

.. and ping you when it’s done!

peeja18:09:49

@anmonteiro There's implementation on there too, if it looks good

anmonteiro18:09:35

will have to study it carefully

peeja18:09:37

It's just a union of the two searches. There's no keyword? or ident? check, but I don't think that check is really necessary: if you supply a bogus key, you just won't find anything in the index.

anmonteiro18:09:10

@peeja yeah I’ve noticed that, and I agree

anmonteiro18:09:22

still have to look more closely because of perf reasons

peeja18:09:39

Yeah, sounds good :thumbsup:

anmonteiro18:09:49

e.g. set/union might not be as performant as into with a transducer

anmonteiro18:09:00

I’ll look in a few

peeja18:09:19

It probably should be, whether it turns out to be or not. If you find it isn't, that may be worth raising as a ClojureScript issue.

anmonteiro20:09:55

@peeja into with sets just works fine so no need to introduce the clojure.set dependency at all

cljs.user=> (into #{1 2} #{3 4 2})
#{1 2 3 4}

anmonteiro20:09:57

other than that the code is almost the same as yours, just s/union/into