Fork me on GitHub
#om
<
2016-10-24
>
levitanong04:10:02

@anmonteiro nice! what strategy did you end up taking for issue #7? (reconciler option)

anmonteiro07:10:58

@levitanong: ended up associng, one of your suggestions. It became possible because of some other design decisions

levitanong08:10:17

@anmonteiro Awesome! Glad it turned out well.

dnolen08:10:07

hrm … pondering now if queries should support clojure.spec

kauko09:10:42

You in Bratislava yet David?

molstt11:10:26

@anmonteiro I think I found a solution. Instead of modifying the ast to get the union select (almost) working, I made it possible to supply a query override to the recurse-remote function supplying the query of only the selected part of the union. It seems to work, but I need to do some cleanup and testing before I know for sure. Thanks for leading me in the right direction!

rackdon11:10:42

Sorry if it’s a stupid question, but… it’s a good practice reference a dom element y the will-mount section?

levitanong11:10:03

@rackdon AFAIK, you should be referencing a dom element in did-mount. You will probably not get anything in will-mount

rackdon11:10:08

and what happen if I need the element in the will-mount? should I put it in the state?

levitanong11:10:30

why do you specifically need it in will-mount?

levitanong11:10:43

is there any reason why you can’t just migrate all the code to did-mount?

rackdon11:10:29

I render a map with an api values, so it can changes over the time….

rackdon11:10:16

I have to put all the functions in the will-mount, but one of the arguments it’s the element where I’ll print the values...

levitanong13:10:11

@rackdon but why not put those functions in did-mount?

levitanong13:10:38

most of the time, any code you’d put in will-mount is perfectly valid in did-mount

rackdon13:10:58

ahhhhh ok, I thought that go loops must be in will-mount….

levitanong13:10:18

yeah, go loops can be in did-mount also, as far as I know. Just don’t put them in render 😛

arohner15:10:43

hi, I’m getting "next.cljc:1964 Uncaught #error {:message "No queries exist for component path <path> :data {:type :om.next/no-queries}}”}. I don’t really understand what that means, or how to fix it

arohner17:10:04

Are there any docs on what exactly can go in a query, and what the constraints are? I feel like that would help me use om next much more effectively

hlolli17:10:21

did you just update om? I got this and it disappeared after cleaning and recompiling.

levitanong17:10:02

@anmonteiro I’m experiencing something strange with om.next + clojurescript 1.9.293. om.next + clojurescript 1.9.229: If I place a println inside a (query [this] …), it properly outputs to console. om.next + clojurescript 1.9.293: neither println nor console.log outputs to console in things related to queries. (parser, send, etc…) But print functions inside render work properly.

jfntn18:10:45

Not seeing this behavior here with cljs 1.9.293 though I’m running om snapshot at the moment

hlolli18:10:22

Something I've never attempted, is it possible to do multiple :send calls so I can have different remotes using different http headers and uri-s?

hlolli18:10:20

I see printing to console that the :send callback is all gathered to one. Can't see quickly how to tell which :remote to use which http call.

jonsmock19:10:27

@anmonteiro Should om normalization work with :route-dispatch false? I didn’t see a test for it, and I wasn’t sure how that was intended

jonsmock19:10:08

If I do (om/tree->db MyAppPage init-data true), om normalizes correctly

jonsmock19:10:38

Where MyAppPage is the component that I give to Compassus

jonsmock20:10:21

Sorry I may not understand something about the existing tests

jonsmock20:10:36

Trying to write one / reproducing

jonsmock20:10:51

Looking like a bug in my remote - sorry to ping

jonsmock20:10:08

Yeah, I can’t figure it out. If I feed my init-data as :state to the reconciler, it normalizes

jonsmock20:10:25

If I hardcode my send to do (callback init-data) it doesn't

jonsmock20:10:33

I’ll try to make a small example

arohner20:10:29

Why can’t you reuse queries? (assert (nil? c) (str "Query violation, " x , " reuses " c " query”))

jonsmock20:10:15

How are you reusing them?

arohner20:10:15

I’m trying to make SPA navigation work, and I’m calling om/set-query

arohner20:10:58

apparently you should only set-query if it changes, but I’m more asking why it’s bad. Largely because I don’t understand how omnext works

jonsmock20:10:09

Are you setting the query with a query from another component?

jonsmock21:10:18

When om gets the query from your component, it adds metadata to it so it knows which component it came from

arohner21:10:50

yes, I understand what it’s doing. I’m asking why

jonsmock21:10:03

Sorry not typing/thinking fast enough

jonsmock21:10:23

It then uses the metadata on the query to re-lookup the component if it needs to

jonsmock21:10:36

The first use case that comes to mind is when it auto-normalizes your data

jonsmock21:10:30

I’m not very familiar with the om next internals, but it has to do something there to go from query to the component’s ident

jonsmock21:10:02

I think it also uses that metadata to quickly find updated components when data changes

jonsmock21:10:38

Have to run but I think that’s the gist

jonsmock21:10:40

Hope it helps

jonsmock21:10:06

(Btw, I just realized you said about navigation; check out compassus)

jonsmock21:10:37

(I assume you’re trying to set your root component’s query to a “page” component’s query? compassus is trying to solve that problem)

jonsmock21:10:59

(otherwise you’ll have to re-root your query and use process-roots)

anmonteiro21:10:33

@jonsmock sorry I don’t understand your question. Happy to look at a minimal repro though to help you figure out what’s wrong!

anmonteiro21:10:06

(might have to wait a few days though, since I’m at euroclojure)

jonsmock21:10:28

@anmonteiro: Awesome, have fun! Yup, I'll put something together.

arohner22:10:10

from the components, identity, normalization tutorial: [{:list/one ~subquery}] What does a map inside a query do?

arohner23:10:49

all of this https://anmonteiro.com/2016/01/om-next-query-syntax/ should be a part of the official docs