This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-13
Channels
- # admin-announcements (1)
- # alternate-reality (2)
- # beginners (15)
- # boot (309)
- # cbus (1)
- # cider (4)
- # cljs-dev (4)
- # clojure (199)
- # clojure-madison (5)
- # clojure-russia (14)
- # clojurescript (59)
- # community-development (57)
- # core-async (5)
- # cursive (8)
- # datavis (6)
- # datomic (1)
- # dysphemism (11)
- # emacs (5)
- # euroclojure (1)
- # hoplon (3)
- # off-topic (103)
- # om (52)
- # onyx (3)
- # parinfer (1)
- # proton (15)
- # reagent (4)
@anmonteiro: I just noticed with om/set-query!
when you set the exact same query a component already has, there's a cryptic error
#object[Error Error: Assert failed: Query violation, [object Object] reuses function etc.
.
Example: https://gist.github.com/IwanKaramazow/3047ae2f0a34733a10ab
Not sure if this is valuable but maybe in the future users of Om Next should be aware that this ain't possible, i.e. a nicer error...
@iwankaramazow: not quite worried about this one, is there a use case for what you're trying to do?
does setting the same query a component have any purpose?
Hello, I have a question regarding how to handle the result of remote queries and remote mutations in a send function. The server response of a remote query is a map, in which keys are the name of a query and the value the result of that query. This can look like this {:query-1 "result-1" :query-2 "result-2"}
. When I pass this to the callback of the send fn it gets merged into my state as it is. The server response of a remote mutation is also a map, but looks a little bit different. The key is the name of the mutation and the value is another map with :keys
and :result
keys. Here's an example: {'my-mutation-sym {:keys [:reread-query-1 :reread-query-2] :result "result-of-my-mutation"}}
. When I pass this to the callback of the send function it will also get merged into my state. But when doing this the state will contain keywords (result of queries) and symbols (result of mutations) as keys. So my questions is, is this the intended behaviour of the callback function? Am I allowed to transform the server rersponse of a remote mutation before passing it to the callback (like does the callback expect the :keys
and :result
keys)?
@anmonteiro: Not really a use case. Just encountered this one while implementing routing. Some child-routes are pure functions, whenever a child is a pure function I om/get-query
the RootView. In some situations this would result into replacing the query with its own query.
Solved it with a simple equality check.
More of a problem on my side of the code actually
Right. Om thinks you're stealing the query because you're setting a component's query with a component's query
which in fact is your own
This could probably be addressed but I'd say it's not a priority
indeed
@anmonteiro om/get-query wiping ^:query-root is considered a bug ?
@geraldodev: not sure about that one. wrt to what you linked regarding process-roots
yesterday that's something which is not currently supported
@anmonteiro: have you seen the defui NestedComp snippet ? Because I think it proves otherwise. In terms of query depth [{:a-thing [{:another-thing [:foo]}]}] and [{:a-thing [({:another-thing [:foo]} {:param :one})]}] are equal, are not ? Because with the 1st process-roots works, and the second it does not. and that is not process-roots fault, it's get-query that is wiping the ^:query-root metadata
I have. As I told you, process roots doesn't support sub-roots
The use case I'm using is very simple: (om/get-query (om/app-root reconciler)) [{:grid [({:cliente [:id :nome :endereco :bairro :cep :cidade :versao]} {:pagina 1})]}] The grid part is local and is about the how the data is fetched, the {:cliente } part is what is meant to be sent to the server. Sorry to bother with this, but the param passing is important, otherwise I can't paginate. Shall I rewrite the query on my own in this case ?
I have a setInterval in a componentWillMount, how do I clear it up in componentWillUnmount? setInterval returns an id, but then I have to pass it to componentWillUnmount, is thre any easy way to achieve it?
I made it! 😄 I had to save the id setInterval returns and load it in componentWillUmount
@geraldodev: seems like a bug
Since the presence of #C0DT1AZD3 seemed to be confusing people and it was getting no traffic, I archived it.
@dnolen: as per @geraldodev 's report, bind-query
is losing query metadata such as :query-root
which makes process-roots
unusable for queries with parameters
@anmonteiro: file an issue, the more information the better
@dnolen: will do.. it seems like the fix would be to walk the query ourselves
clojure.walk
doesn't preserve the metadata
@anmonteiro: hrm it should but maybe there’s a problem somewhere
I've confirmed it
@dnolen: also the Eastwood linter re-implemented walk because of this too. from the docstring: walk was copied from Clojure 1.6.0, and then modified to preserve metadata on all sub-values of the input form that have them.
@anmonteiro: hrm wow, yeah for some reason I thought Clojure walk preserved meta. Happy to see us use a version that fixes that problem.
@dnolen: happy to submit a patch.
you didn't mean to re-implement walk
ourselves right? just to be clear
I'm sure custom walking is enough since it's only used in this case
ok, thanks!
adding a query to one of my components is causing it to fail to render, and I have no idea why
@cjmurphy: I think it's because one of my read functions returns an empty map for {:value {}}
I got lucky while commenting out different aspects of the component in question, and having a query stopped it from rendering
you might have a query which supports pagination … as you set page, you update IQueryParams
https://github.com/omcljs/om/wiki/Remote-Synchronization-Tutorial shows an example of a search box