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?
@pedroteixeira I tested an early version of Fiber and it works fine with Om Next
2👍there’s like 1 line of code that needs changing
not sure we’ll benefit from anything apart from what every other person who’ll switch to it will also get
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)})))
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.
It calls the parser recursively, there is some more explanation here: https://awkay.github.io/om-tutorial/#!/om_tutorial.E_State_Reads_and_Parsing
@anmonteiro curious what’s that line? 🙂 (for the reason that I’m already using React 16 alpha via the React Native 0.44)
I haven’t noticed anything weird, but curious in any case
@raspasov https://github.com/omcljs/om/compare/master...anmonteiro:js-modules#diff-ee424e6559581b5b893371373a777e5eR188
anmonteiro: got it, thanks! so basically just a change around the requires?
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
most don’t matter. the line I mean is changing goog.object/getValueByKeys
to some->
got it, thank you! 🙂