@darrellesh: sweet! I'll send you a private message soon.
Hey! Should this be something other than contains?
https://github.com/untangled-web/untangled-client/blob/b1eb776d3bfff2035dcbcf521f9060a6cf30cd61/src/untangled/client/impl/data_fetch.cljs#L127
I have a query that after running query->ast
returns something like
{:key [:item-list [{…}]]}
, and elide-ast-nodes
can’t remove the :item-list
keyword because contains?
on a vector checks if the numeric key is within the vectors range.
This is part of a union query, so I might be doing something wrong here...
@gardnervickers: I'm not sure that any of the apps that we've made so far send a union query to the server, so it's quite possible that there's a bug in there. I believe all that function does is remove the keywords from the :without
set on a data fetch
Gotcha, I was trying to load data for all tabs except one, but I can also just load each individually.
@ethangracer Have you landed in NYC?
@darrellesh: I have!
@gardnervickers: how you interpret the query on the server is up to you, Untangled should respect elisions from your Union query. If you can submit a small repro as an issue I can take a look at it
@ethangracer Talk to you in the morning...
@darrellesh: sounds good!
@gardnervickers: we'll have to be careful though because eliding a keyword in the Union itself could generate the wrong ast if eliding that keyword turns the union into a join
Ok no problem,
(elide-ast-nodes
(om/query->ast
[{:current-tab {:console [:data]
:dashboard [:data]}}])
#{:console})
That will not elide anything in the query. In elide-ast-nodes
, checking for (contains? elision-set union-key)
in addition to key
yields the desired results but I’m not sure what happens if, like you said, a union only has one thing in it.@gardnervickers: thanks! I'll investigate in the morning
(defn elide-ast-nodes
"Remove items from a query (AST) that have a key listed in the elision-set"
[{:keys [key union-key] :as ast} elision-set]
(when-not (or (contains? elision-set key)
(contains? elision-set union-key))
(update ast :children (fn [c] (vec (keep #(elide-ast-nodes % elision-set) c))))))
Thanks!
@gardnervickers: that looks good to me. I think if the dev removes a keyword from the union query that violates how a union query should be constructed, it’s not on us. I might log a warning
thanks for letting us know
@gardnervickers https://github.com/untangled-web/untangled-client/pull/27
I’m gonna let it sit for a bit to make sure we’re not missing something but I think that’s it
Great, thank you @ethangracer
pull request merged
0.5.5-SNAPSHOT updated on clojars @ethangracer @gardnervickers
Thanks!
sure, thanks for the report