Fork me on GitHub
#om
<
2016-10-21
>
molstt10:10:46

@anmonteiro It would be fantastic if you could have a look at this question that I have struggled with for quite a while now. I'm trying to do my own union routing to increase my control and understanding of how it all works, but I have this problem getting the remotes working. If you look at the comments in the code you can see that I've had some success with a couple of solutions, but never got it all working. https://github.com/molst/om-routing-with-union-query

molstt10:10:36

@anmonteiro The main question is in the Readme

anmonteiro10:10:26

@molstt sorry a bit tied up with some stuff, might have to wait until the weekend

molstt10:10:37

sure, thanks in advance!

ethangracer15:10:01

is it possible to make a component with a query and ident that can be dynamically injected with different render functions? I have an identical set of props that I want to render in several different ways in the app, but I don’t want to copy the query and ident into several different components

anmonteiro15:10:39

@ethangracer depends when you want to “dispatch” the different render fns

anmonteiro15:10:59

a single component that dispatches at render time based on some heuristic would work

anmonteiro15:10:11

or you could use ui to dispatch at component creation time

ethangracer15:10:44

it would have to be at component creation time — the props would be identical at render so can’t dispatch that way. by ui do you mean an anonymous component?

ethangracer15:10:47

know of a good snippet using ui?

anmonteiro15:10:18

@ethangracer it’s just like defui. here’s one:

(ui
  static om/IQuery
  (query [this]
    [:foo]))

anmonteiro15:10:31

(except you don’t give it a name)

ethangracer15:10:29

@anmonteiro interesting, i’ll play with that a bit. thanks

arohner15:10:16

When using :send, what is the format for the server response? Is that documented anywhere?

wilkerlucio16:10:51

after updating cljs to 1.9.293 and om to alpha47 I'm getting this when trying to compile:

wilkerlucio16:10:50

initially I though was untangled issue, but seems more like to be Om issue when untangled tries to load it

anmonteiro17:10:45

@wilkerlucio if the problem is the warning, you can disable them in Figwheel

anmonteiro17:10:13

it should of course be fixed in om.dom, we need to exclude that new cljs.core var

jonsmock17:10:09

Stupid question - can someone tell me what the read should look like for this example: http://stackoverflow.com/a/35680798/25538

jonsmock17:10:20

I’m sure it’s been answered a million times, but I’m struggling

jonsmock17:10:36

Basically you have a query like [{:widget {:list [:name :created]}}]

jonsmock17:10:54

Where :widget is pure UI and you want to re-root for :list

wilkerlucio17:10:02

@anmonteiro I don't think this is the case, this is not on update, it's on compiling, even using lein cljsbuild I can't compile with cljs 1.9.293, full trace on the lein process:

wilkerlucio17:10:48

it works if I revert the cljs version

anmonteiro18:10:02

@wilkerlucio I would check what transit versions are in your classpath first of all

wilkerlucio18:10:53

@anmonteiro checked my path, those are the versions:

wilkerlucio18:10:55

[com.cognitect/transit-clj "0.8.290"] [com.cognitect/transit-java "0.8.316"] [com.cognitect/transit-js "0.8.846"] [com.cognitect/transit-cljs "0.8.239"]

anmonteiro18:10:33

@wilkerlucio sure? is that what lein deps :tree outputs?

anmonteiro18:10:39

or boot show -d

anmonteiro18:10:34

@wilkerlucio does it work without :parallel-build?

wilkerlucio18:10:03

@anmonteiro same thing with :parallel-build false

anmonteiro18:10:34

@wilkerlucio probably worth bringing it up in #cljs-dev then. I can’t help you more right now

wilkerlucio18:10:48

ok, thanks for the support so far

wilkerlucio18:10:13

I'll try to reduce it to a minimal case before ask more on it

anmonteiro18:10:57

@wilkerlucio one last attempt to debug what might be going on would be: remove transit-clj from your project and compile it with :cache-analysis true

anmonteiro18:10:18

I’d be interested to see the .edn analysis file for that namespace that’s failing

wilkerlucio18:10:42

@anmonteiro ok, so you mean I add the transit-clj into the untangled :excludes?

anmonteiro18:10:07

I don’t know, but make it so that transit-clj is not in the classpath at all

wilkerlucio18:10:03

I'm not sure how to do that, since transit-clj is a dependency of untangled, and I need untangled to compile (and the namespace that's crashing is also part of untangled)

anmonteiro18:10:48

transit-clj shouldn’t be an untangled client dependency right?

wilkerlucio18:10:02

maybe shouldn't, but currently it is

anmonteiro18:10:26

@wilkerlucio what I mean is, the client is supposed to be ClojureScript

anmonteiro18:10:36

so you can compile that without a transit-Clojure dep

wilkerlucio18:10:31

yes, I just don't know how to remove the transit-clj, it's not part of my project either

wilkerlucio18:10:00

on the tree it comes all as untangled-client dependencies

wilkerlucio18:10:30

I have the transit-cljs as my dependency (my server side is cljs as well), when I remove it, it just goes under untangled-client dependencies

wilkerlucio18:10:01

ah, sorry, not untangled, it's an Om dependency

wilkerlucio18:10:46

ok, seems to be removed, trying again

wilkerlucio18:10:14

@anmonteiro removing transit-clj makes Om fails to compile:

tobiash18:10:01

Hi there. It's funny, I joined this channel basically to ask what @jonsmock asked an hour ago. I tried (assoc ast :query-root true), but process-roots doesnt re-root my query. Is there a working example for this?

jonsmock18:10:32

I’m currently looking at tony kay’s tutorial - one sec

jonsmock18:10:47

Seems to be working on the read side, but I haven’t gotten my example entirely working

jonsmock18:10:29

I think om/ident? is removed btw

jonsmock18:10:39

But other than that, it seems to be working for me

tobiash18:10:02

i think om/ident? moved to some util namespace in om.next

tobiash18:10:14

i read through this code yesterday, and it made me (i think) basically understand how to write parser code

tobiash18:10:21

but process-roots does not return a re-rooted-query, just query, which is the same as my original query

tobiash18:10:50

i am using the compassus library and at the route level the parser returns { target (assoc-in ast [:query] (parser env query target)) }

tobiash18:10:43

then the actual component query is parsed to { :remote (assoc ast :query-root true) }

jonsmock18:10:26

Sorry - yeah I had to change it to query also

jonsmock18:10:31

not re-rooted-query

jonsmock18:10:39

Yup, we’re using compassus now too

jonsmock18:10:49

I also had to change our read to be like

jonsmock18:10:06

(if-let [page-data (:account/index @state)] {:value page-data} (recurse-remote env k true) ))

jonsmock18:10:25

Sorry that’s a little rough; literally just figured it out and pasted it here

charliekilo18:10:27

don’t you have code highlighting?!?

jonsmock19:10:20

@charliekilo stop trolling me 😉

tobiash19:10:51

@jonsmock i assume you commented out the descend stuff from recurse-remote?

jonsmock19:10:38

No, but I did comment out the “then” branch in descend, because I didn’t know about the moving of om/ident?

jonsmock19:10:49

And I knew I wasn’t querying with idents yet

jonsmock19:10:13

Haha I just was pasting that to you haha

tobiash19:10:17

but it's not in the "next" directory, so I'm not sure it's the correct one

jonsmock19:10:17

Thanks for the tip

jonsmock19:10:43

Looks like these are om.next related things, so I think we’re good

jonsmock19:10:47

The impl looks correct

tobiash19:10:15

ok. but I haven't ventured to figuring out idents yet 🙂

jonsmock19:10:26

Might not be in om.next directory b/c of a future migration path - don’t know

tobiash19:10:57

so any ideas how the :query-root flag actually travels to the send function? I am wondering since send doesnt get an ast, but just the query, and there is no trace of :query-root in the query it receives. Is it some Clojurescript metadata magic?

jonsmock19:10:02

Hmm, that’s what I was thinking too

jonsmock19:10:21

Has to be meta data right? (looking)

jonsmock19:10:12

I know the queries returned by components have meta data about the components and stuff

jonsmock19:10:35

Yeah looks for meta data :query-root

tobiash19:10:52

hmmm... that might be my problem, because in my case there doesn't seem to be any metadata on any node of the query

tobiash19:10:35

na, it's there, i was printing it wrong. The query that lands in send is [{:app/home [^{:query-root true} (:google-signin/current-user)]}]

tobiash19:10:15

and i would like to re-root it to [:google-signin/current-user], without the :app/home

tobiash19:10:11

so that looks like my parser is working correctly?

arohner19:10:56

is there any kind of error signaling at all, in remote queries?

currentoor20:10:22

Is there a way to elide the logging of transaction in dev?

anmonteiro20:10:13

@currentoor easiest way is to set :logger to nil in the reconciler

currentoor20:10:58

@anmonteiro I was hoping to just set a character limit so small log lines would still show up.

currentoor20:10:14

Would setting :logger to nil just disable logging completely?

anmonteiro20:10:08

you could probably use your own logger as well that only logs messages up to a certain character limit

anmonteiro20:10:23

I’d look in Closure Library’s goog.log namespace

anmonteiro20:10:34

probably also more trouble than it’s worth, but that’s not up to me to decide 🙂

currentoor20:10:48

Then just pass that in as :logger?