om

Please ask the channel first, not @dnolen directly!
pedroteixeira 2017-05-24T01:43:24.894595Z

I was wondering if Om.Next would benefit from anything specific in the new React 16 (with fiber, etc)? Has any already tested the alpha?

anmonteiro 2017-05-24T01:49:22.941042Z

@pedroteixeira I tested an early version of Fiber and it works fine with Om Next

2👍
anmonteiro 2017-05-24T01:49:30.941953Z

there’s like 1 line of code that needs changing

anmonteiro 2017-05-24T01:50:27.949655Z

not sure we’ll benefit from anything apart from what every other person who’ll switch to it will also get

2017-05-24T10:37:45.367895Z

You might be interested in these read helpers:

(defmulti read om/dispatch)
(defmulti mutate om/dispatch)

(defn read-join [{:keys [parser query target ast] :as env}]
  (let [ret (parser env query target)]
    (if target
      (when (seq ret)
        {target (assoc ast :query ret)})
      {:value ret})))

(defn read-union [{:keys [query] :as env} union-key]
  (let [union-query (cond-> query (map? query) (get union-key))]
    (read-join (assoc env :query union-query))))

(defmethod read :default
  [{:keys [ast state] :as env} key params]
  (let [st @state
        ns (namespace key)]
    (condp = ns
      "join" (read-join env)
      {:value (get st key)})))

2017-05-24T10:39:54.394348Z

It allows queries like [{:join/child (om/get-query Child)}] and you can write the Child query as though it were part of the root query.

2017-05-24T10:41:14.410660Z

It calls the parser recursively, there is some more explanation here: https://awkay.github.io/om-tutorial/#!/om_tutorial.E_State_Reads_and_Parsing

raspasov 2017-05-24T22:48:53.991456Z

@anmonteiro curious what’s that line? 🙂 (for the reason that I’m already using React 16 alpha via the React Native 0.44)

raspasov 2017-05-24T22:49:15.995802Z

I haven’t noticed anything weird, but curious in any case

raspasov 2017-05-24T22:52:28.033693Z

anmonteiro: got it, thanks! so basically just a change around the requires?

raspasov 2017-05-24T22:55:12.066211Z

don’t want to waste too much time, since there’s no problem atm 🙂 but I think the link goes to a diff with a bunch of small changes? https://github.com/omcljs/om/compare/master...anmonteiro:js-modules#diff-ee424e6559581b5b893371373a777e5eR188

anmonteiro 2017-05-24T22:55:48.073099Z

most don’t matter. the line I mean is changing goog.object/getValueByKeys to some->

raspasov 2017-05-24T22:56:04.076154Z

got it, thank you! 🙂