untangled

NEW CHANNEL: #fulcro
2016-08-30T00:53:34.000017Z

@darrellesh: sweet! I'll send you a private message soon.

gardnervickers 2016-08-30T03:06:04.000018Z

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.

gardnervickers 2016-08-30T03:22:09.000020Z

This is part of a union query, so I might be doing something wrong here...

2016-08-30T03:24:33.000021Z

@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

gardnervickers 2016-08-30T03:32:54.000022Z

Gotcha, I was trying to load data for all tabs except one, but I can also just load each individually.

darrellesh 2016-08-30T03:34:59.000023Z

@ethangracer Have you landed in NYC?

2016-08-30T03:35:33.000024Z

@darrellesh: I have!

2016-08-30T03:36:48.000025Z

@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

darrellesh 2016-08-30T03:38:14.000026Z

@ethangracer Talk to you in the morning...

2016-08-30T03:39:17.000027Z

@darrellesh: sounds good!

2016-08-30T03:42:21.000028Z

@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

gardnervickers 2016-08-30T03:48:51.000029Z

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.

2016-08-30T03:51:38.000031Z

@gardnervickers: thanks! I'll investigate in the morning

gardnervickers 2016-08-30T03:53:47.000032Z

(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))))))

gardnervickers 2016-08-30T03:54:07.000034Z

Thanks!

2016-08-30T14:02:31.000035Z

@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

2016-08-30T14:08:55.000037Z

thanks for letting us know

2016-08-30T15:14:04.000040Z

I’m gonna let it sit for a bit to make sure we’re not missing something but I think that’s it

gardnervickers 2016-08-30T15:15:17.000041Z

Great, thank you @ethangracer

tony.kay 2016-08-30T17:20:37.000042Z

pull request merged

tony.kay 2016-08-30T17:21:07.000043Z

0.5.5-SNAPSHOT updated on clojars @ethangracer @gardnervickers

gardnervickers 2016-08-30T17:21:20.000044Z

Thanks!

tony.kay 2016-08-30T17:21:28.000045Z

sure, thanks for the report