Fork me on GitHub
#om
<
2016-08-29
>
krchia02:08:17

hi i have a fairly simply problem - i’m looking at a reagent piece of code where they use session/put and session/get with secretary to store the current page they’re on

krchia02:08:38

how can i do the same with om? store it in app-state?

hlolli08:08:51

yes, or set-query!, I mean there are various ways to solve this. One idea, is to change the queries of the root component depending on page you are on and have some transactor on page change, maybe trough bidi or secretary.

julianwegkamp14:08:00

Hi. What is currently the preferred way to update an application's state with data from outside the om scope (e.g. websocket). I think I have read somewhere that you should use om.next/merge! but when I use this no new render is scheduled. I could also use om.next/transact! but I think I've read somewhere that this is not the preferred route.

niamu16:08:55

cb in this case returns the function om.next/merge! and should alter the state and cause a re-render. The only reason a re-render wouldn’t happen is if a re-render is not needed because the state didn’t change for the currently mounted components.

selfsame17:08:25

@hlolli: for realtime high performance stuff usually best to work outside of om/react

hlolli18:08:37

@selfsame ok good to know, I may look into just declare muteable js variable. But this example here https://hlolli.github.io/ is update-state! on every beat, causing the gray areas to light up. (open this with google chrome and wait 1 min for it to load, also the crackling sound is something I'm fixing as I write this). But this are slow enough updates as not to cause too much load, but I may want to send different signals, but good for now.

selfsame18:08:21

neat! that might be lightweight enough to do with update-state!, I was imagining an audio visualizer not a sequencer 🙂