This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-22
Channels
- # alda (1)
- # aws-lambda (23)
- # beginners (27)
- # boot (156)
- # business (2)
- # carry (4)
- # cider (1)
- # cljsjs (2)
- # cljsrn (29)
- # clojure (170)
- # clojure-austin (35)
- # clojure-czech (8)
- # clojure-dusseldorf (5)
- # clojure-italy (4)
- # clojure-nl (1)
- # clojure-quebec (2)
- # clojure-russia (45)
- # clojure-spec (49)
- # clojure-uk (12)
- # clojurescript (81)
- # component (5)
- # datomic (24)
- # devcards (26)
- # emacs (4)
- # hoplon (4)
- # jobs (1)
- # juxt (5)
- # leiningen (6)
- # luminus (14)
- # mount (26)
- # om (27)
- # om-next (2)
- # onyx (22)
- # pedestal (2)
- # planck (3)
- # proton (5)
- # re-frame (19)
- # reagent (2)
- # ring-swagger (60)
- # spacemacs (12)
- # specter (8)
- # untangled (119)
- # vim (61)
- # yada (36)
I’m poking at the reconciler in tests, and I’d like to assert on the props that a component will receive but can’t figure out how to do that.
I saw (parser (#'om/to-env reconciler) query)
in the om.next test suite which makes sense if query is the root query, but I’d like to reconstruct the parser result for a nested component
How can I get to something along the lines of (parser (#’om/to-env reconciler) (om/get-query SomeSubComponent))
, assuming I need to reconstruct the parent path somehow but I’m not sure...
Howdi, I've just read the tutorials and started to implement two components. It seems like the callback that is used to merge changes to the state in a send-function does not trigger reads. I expected that when I call the cb with a map containing a new value for a key, and I have a query in a component for the same key, as well as a read function for the same key, then the read function would be called..? Do I have to use something like transact! in order to trigger the necessary reads?
@molstt If I’m not mistaken in your initial transact!
call you can add read keys to your expression like '[(my/mutation) :read-this :read-that]
although it may be tricky to use in isolation, since it depends on the path where the component is mounted
Though it needs an instantiated component and I haven’t dealt with those at all so far, but I guess you would need to in any case…?
@jfntn ok, currently I don't have any initial transaction. I read from a remote in a send-function (as in the remote tutorial) and use the callback to "transact" some novel state.. Shouldn't that have the same effect (rerenderings) as a transaction? om/transact! requires a component or the reconciler, so I would have to do some redesign if I have to do that..
@jfntn Well, sure, but the path that makes it a full query has to come from somewhere. 🙂 You could mount the same component at different places, and it would have a different full-query
.
I suppose you could put something like [{:some-key [{:another-key (om/get-query SomeSubComponent)}]}]
in your test, and consider the [:some-key :another-key]
part of your test data. That is, you're saying this component's query does the right thing if it's mounted at that path.
@peeja yes that’s what I was thinking, it might become overwhelming to assert over the entire app-state after a while but at this point this is probably the better option
@jfntn the novelty goes straight into a previously unused entry via the callback, then there is another component that has the entry (key) in its query and read function. So, I would say the answer is yes.
@molstt try to (clojure.pprint/pprint (deref reconciler))
after the remote read comes in, it’ll show you the current state, it should help understand where your data ended up
Looking for some advice: We've got a fair bit of domain logic that calculates values based on domain data. In an Om Next world, our data maps don't always have all of the possible keys anymore: they only have they keys that a component queried for. When a component uses a key's value directly in its render
, it's obvious what to query for. But when it needs to pass data to some domain logic to calculate something, there's no way to know what to query for without looking through the code or documenting it in a docstring.
Are there any good techniques people have for surfacing what keys you need to be querying for?
Essentially, I want to be able to compose subqueries that I get from functions, not just components. (Although that may not literally be how a good solution would work.)
@jfntn yes, the data enters the reconciler, so I suppose it's my other component's reading that's problematic, will focus on that