Clojurians
#om
<
2017-05-24
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

pedroteixeira01:05:24

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?

anmonteiro01:05:22

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

anmonteiro01:05:30

there’s like 1 line of code that needs changing

anmonteiro01:05:27

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

danielstockton10:05:45

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

danielstockton10:05:54

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.

danielstockton10:05:14

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

raspasov22:05:53

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

raspasov22:05:15

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

raspasov22:05:28

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

anmonteiro22:05:01

requires? I think I linked the specific line

raspasov22:05:12

don’t want to waste too much time, since there’s no problem atm :slightly_smiling_face: 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

anmonteiro22:05:48

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

raspasov22:05:04

got it, thank you! :slightly_smiling_face: