Fork me on GitHub
#re-frame
<
2016-09-10
>
rui.yang06:09:13

Hi wonder if someone could tell something wrong I did to mimic logic in re-com?

rorydouglas13:09:27

@rui.yang m in main-page either needs to be a reagent.ratom/reaction or you should just use model as the input to form-input

rorydouglas13:09:33

if you put debug statements on the value of @m and @model inside main-page render you’ll see model is indeed incrementing, but that won’t cause m to change. m is statically assigned the initial value of the model atom - it’s not linked reactively

rorydouglas13:09:35

also, when i’m making components with internal state atoms, i usually operate on the internal state atom & then “publish” to the outside world via callback

rorydouglas13:09:44

(pattern copied from re-com)

rorydouglas13:09:31

also, i’m assuming the above (atom)’s are reagent.core/atom not regular cljs.core/atom?

rorydouglas13:09:03

note there’s a #reagent channel dedicated to reagent/react questions

rorydouglas13:09:52

nvm i see you found it

rui.yang13:09:43

@rorydouglas thanks for answering. I spent some time to debug step by step. and yes I missed reaction part

rui.yang13:09:21

also I figured out that inside reaction, I must deref the previous signal (atom), otherwise it won’t work

rorydouglas13:09:43

@mikethompson regarding the debounce interceptor above, I see this won’t work because it’s not possible to re-route messages in an interceptor. The final handler is determined up-front by the initial event-id in reframe.events/handle & can’t be changed afterwards figured it out in throttle interceptor below

rui.yang13:09:41

also thanks for the double posting remindering. I double posted because I wasn’t sure which channel I should ask, whether it is reagent related or actually re-frame question.

rorydouglas13:09:44

i guess the approach then @m9dfukc would be to debounce in regular cljs prior to dispatching the event

rorydouglas13:09:50

@rui.yang oh not a problem 🙂 i know it’s unclear when it comes to re-com related questions where it makes sense to post

rorydouglas13:09:20

@m9dfukc i guess a dispatch-debounce helper fn would actually fit in nicely alongside dispatch-sync etc - controlling the behavior from the call-site directly

rorydouglas14:09:36

ah the correct way to terminate event processing is to modify the context :queue

rorydouglas14:09:15

and what i’m doing is throttling not debouncing. after all this, seems it probably is something better handled prior to dispatch, but if you need it @m9dfukc

rorydouglas14:09:20

i removed the other junk from yesterday since it was incorrectly named & mainly a conversation with myself