Fork me on GitHub
#re-frame
<
2017-11-03
>
Miloslav03:11:24

@poernahi thank you a lot but it's too hard for me right now

orestis12:11:19

Hi, I’m looking for advice on how to integrate a persistent websocket connection with re-frame. This is the first re-frame code that I write, so I (perhaps naively?) created a global “socket” object that connects, registers handlers and so on. Are there better approaches? What about figwheel and code reloading? I do want a defonce somewhere to avoid re-connecting on every code reload, ye?

zallin15:11:07

hello everyone, how do you manage event handlers chaining ? for instance, I want my application to do some xhrs sequentially, one by one and also I want actual event handlers to stay loosely coupled i.e. no things like

{:handler #(rf/dispatch [:next-step])}
. Is there a part of re-frame api that allows these kind of behavior or should I implement it myself ?

danielneal15:11:05

I use re-frame-async-flow-fx

danielneal15:11:36

you can declare a kind of chain or pattern, so subsequent events dispatch after having 'seen' e.g. a success or failure

danielneal15:11:16

I think there's definitely room for improvement though, @mikethompson mentioned CEP the other day; some sort of pattern matching/state machine/automata could be interesting here.

abp15:11:25

Hey @zallin you could set some db-state from the success/failure handlers of your events and dispatch a general event which decides (call a multimethod) via the db-state what to do. But that maybe doing manually what @danieleneal suggested.

danielneal15:11:01

yep agree @abp that's probably the best way to start, async-flow-fx is more an option to be assessed to see if it's appropriate

zallin16:11:53

@abp yes that s what i ve been thinking too

zallin16:11:37

@danieleneal CEP ? what is it ?

danielneal16:11:11

this is the library mike mentioned

zallin16:11:00

ok I ll look into that thx

danielneal16:11:17

that could well be overkill though 😄

zallin16:11:23

agree 🙃

scknkkrer16:11:13

Guys, Can someone help me about using react-native-camera external module on re-natal app ? Just tell me, how can I run it within it ?

rgm23:11:00

I'm starting to play around with using taoensso/timbre for profiling ... is there a good place to wrap the outer (profile {} ...) call to catch component activity or am I thinking about this all wrong? My goal is to get timings on some (possibly?) expensive render and component-did-mount work (that last because I'm using D3).

rgm23:11:34

or am I better off with knowing how to better make use of the Chrome devtools?

mikethompson23:11:21

@rgm I'm not really answering your question about profiling, sorry, but be sure to read (links at the bottom on D3): https://github.com/Day8/re-frame/blob/master/docs/Using-Stateful-JS-Components.md

mikethompson23:11:54

re-frame-trace may be useful for timings, maybe. Still developing

mikethompson23:11:04

But no help for component-did-mount timings

rgm23:11:57

Yeah, I saw that re-frame-trace caught the render but that's dwarfed by D3's work here.

rgm23:11:13

it's nbd to (profile {} (p ::my-tag (do-the-d3-work ...) at its callsite in component-did-mount and just get that timing, but I was just wondering if there's a good strategic place to do that much further out so I can just leave the timbre probes in place and toggle them on/off with one (profile {} ... ).

rgm23:11:38

the advantage there I guess would be that I could get a summary of multiple renders and get the stddev, etc.

rgm23:11:51

(assuming the same component appears multiple times with different props, say).