Fork me on GitHub
#om
<
2016-04-23
>
tomconroy00:04:45

@grounded_sage: i got this exercise to work, maybe your issue has to do with (om/computed people deletePerson) (it should be like (map (fn [person] (om-person (om/computed person {:onDelete #(js/console.log "delete" p)}))) people))

grounded_sage00:04:29

Yea that makes sense. Thanks I managed to get it. Must just be sleep deprived 😛

tomjack05:04:33

tree->db assumes for a 'many join' [{:foos (get-query Foo)}] that the first of the idents is the same for all the foos

tomjack05:04:42

should it?

tomjack06:04:44

hmm, my 'fix' would be to just always do the "union case" in "normalize many"

dnolen19:04:45

1.0.0-alpah34 released, @anmonteiro’s query updating stuff merged in, big change, so feedback welcome

iwankaramazow19:04:32

No breaking changes here, even the router seems to work fine, will throw some 'big-data' at it

anmonteiro20:04:16

specifically, you want to be testing getting and setting queries

anmonteiro20:04:06

especially setting queries in 1-1 joins down the component hierarchy

anmonteiro20:04:24

and see if get-query of the root instance has the changes reflected

iwankaramazow20:04:09

K, I'll throw in some of those scenarios

iwankaramazow20:04:55

One thing I've been wondering: would it be a good idea to pass the reconciler to the send function? (provided by Om self) There are some scenarios where I want to run a bunch of mutations when something comes back from the server. Think user logs in, transact a mutation that redirects to some page, or show an error message things went wrong at the server. For now I have to do something like

(defn make-reconciler
  [{:keys [state parser merge merge-tree migrate id-key]}]
  (let [escape-hatchet (atom nil)
        config {:state state
                :parser parser
                :migrate migrate
                :id-key id-key
                :merge merge
                :merge-tree merge-tree
                :send (transit-post "/api" (assoc {} :reconciler  escape-hatchet))}
        reconciler (om/reconciler config)]
    (reset! escape-hatchet reconciler)
    reconciler))
to avoid a circular dependency & have the reconciler available in my send function Is this outside the scope of Om self?

taylor.sando20:04:38

The merge function gets the reconciler, derefed app state, server response and the query request if that helps.

taylor.sando20:04:49

Though I wouldn't mind getting the reconciler in the send function. I have a case where I like to alter the state on certain read remotes, and it makes sense to do it in send, when I know what all the remote values are. You can potentially do the transact in the read function, when there is a remote target, but it didn't seem right to be doing transactions in the read function.

hkjels21:04:28

The docs on set-query! says that re-sends will happen when necessary. Anyone know how it is decided when it’s necessary? Tried looking into the set-query!-function but it’s a bit difficult to grasp

taylor.sando21:04:04

If the component that set-query! has anything in its query that causes a remote read, or if you specify any reads as a last argument to set-query!

hkjels21:04:10

Of course. I now see that it’s my read-fn that’s not being called at all for some reason