Fork me on GitHub
#re-frame
<
2018-05-27
>
jrbrodie7703:05:33

I'm running into a head-scratcher with re-frame. I'm getting 'Error <! used not in go block' but I've got go blocks everywhere and I've tested the functions in question outside of re-frame. Has anyone seen this before? (Seems possibly related to the go block taking 10+ seconds). I also seem to have fixed it by moving he go block into a separate function, no idea why that helped.

akiroz09:05:33

@jrbrodie77 is it possible to create a minimal environment that reproduces this? IIRC re-frame no longer depends on core.async for the event loop nowadays.....

ackerleytng14:05:09

i have a bunch if mp4s on a page, and when i press the spacebar i want all the "marked" mp4s to play at once. so far, my app-db is

{:videos {1 {:id 1 :marked true :filename "blah.mp4"} 2 {:id 2 :marked true :filename "blah2.mp4"}}}
how would like do something like (dispatch [:play <id>]) and have the videos watch for this dispatch and play?

jrbrodie7714:05:36

@akiroz I will try to duplicate it.

akiroz15:05:53

@jrbrodie77 Have you seen this guide for encapsulating stateful components like players? https://github.com/Day8/re-frame/blob/master/docs/Using-Stateful-JS-Components.md

akiroz15:05:25

If I were to implement this, I'd store a boolean :playing flag for each video in the app-db and subscribe to that flag in each of the corresponding video components.

akiroz15:05:55

your reg-event-db :play is just gonna look something like this:

(fn play [db [_ id]]
  (assoc-in db [... id :playing] true))

ackerleytng15:05:08

oh wow, thanks i'll definitely look at that!

akiroz15:05:31

Oh crap, I mentioned the wrong person since the slack icons look the similar (facepalm) Sorry jrbrodie77, I meant to reply to @ackerleytng

Bravi19:05:41

I’m trying to use :progress-handler on re-frame's http-xhrio and I was wondering if there’s an example of this anywhere?

Bravi19:05:18

couldn’t find anything useful by just googling

mikethompson22:05:07

@bravilogy look in the "External Resources" document in /docs. Example application in there.

mikethompson22:05:02

See re-frame-http-fx