Fork me on GitHub
#om
<
2017-07-21
>
urbank13:07:44

Is there a way to trigger a callback after a rerender? or just requestAnimationFrame?

ajs13:07:19

@urbank : on every re-render or just some? your view function runs on every render, so you could just put logic right in there, or call another function, which will run on every re-render

urbank13:07:52

@ajs Oh, yeah, I wasn't specific enough. I meant after an om/transact!

urbank13:07:16

after a specific om/transact!

ajs13:07:58

what i do myself is send all transact or update messages on a go channel. then when i listen to that channel, if a particular key that was sent along with the transact or update messages is of interest, i do something specific when i receive that transact for that key

ajs13:07:54

incidentally the reason i do this in Om Now is so that any component function can transact on any part of Om state, even if it is not related to the cursor that component received

urbank13:07:03

@ajs Ah, I see. Interesting. Haven't seen go block used much in the om next examples within the ui

ajs13:07:12

yeah om next is different

ajs13:07:22

but you can still write Om Now code using Om Next

ajs13:07:32

the dom and core namespaces are the same

ajs13:07:56

i'm actually a big fan of Om Now

urbank13:07:12

@ajs You prefer it to om next?

ajs13:07:19

definitely for me, for now

ajs13:07:29

Om Next is really a very different animal

ajs13:07:47

Om Now is stable and pretty simple. Om Next is neither of those things (yet)

urbank13:07:31

I find that it's quite simple using #fulcro

dehli13:07:24

Hey guys, I'm sure this is a Clojure mistake but I'm having a tough time figuring out what my issue is with updating my state. Does anything jump out? When I call this, state doesn't change.

(om/update-state! this
                  update-in
                  [:props :project/nodes]
                  (fn [nodes]
                    (vec (map #(merge % {:node/selected true})
                              nodes))))

gardnervickers13:07:44

@urbank you can use :tx-listen to get a feed of transactions. We've been considering using it for things like reporting google analytics.

urbank13:07:00

That sounds fairly straightforward. I'll check it out.

ajs13:07:45

@dehli which state are you trying to update, the app state or the component local state?

dehli13:07:53

component local state

dehli13:07:58

okay, so this is the problem from coding late at night 🙂 I'm overriding state in componentWillReceiveProps

dehli13:07:39

Thanks for the help!

levitanong14:07:14

Hi all, I’m trying to use om/force, and the documentation says to look for a :target key in the ast, but it doesn’t seem to exist in ast. I have, however, found :target in env. Has the target been moved to env, or is this a different thing altogether?