re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
benny 2020-07-09T04:24:51.348600Z

how do i dispatch an event from another event?

benny 2020-07-09T04:27:01.349200Z

my initial guess is to write an effect but i would imagine this use case might be built in?

2020-07-09T04:52:34.349900Z

@benny there is a builtin effect :dispatch

đź‘Ť 2
benny 2020-07-09T05:01:55.350300Z

thanks @mikethompson

2020-07-09T05:54:31.354700Z

Are there ways to listen to events and dispatching additional events on dispatch? Like enqueuing an event after another without the use the :dispatch effect? One solution is re async flow, but I wonder if there was something easier? The reason I am asking this is sometimes you want to have chain of events, but you want the definition of the chain outside the ancestor events.

2020-07-09T12:24:17.360800Z

Say you write events :a, then how do you hook event :b, without rewriting :a?

p-himik 2020-07-09T12:27:07.361Z

Do you want to always dispatch :b when :a is dispatched?

2020-07-09T12:31:50.364800Z

Yes, but maybe :c

2020-07-09T12:31:59.365400Z

But what if you don’t control :a

p-himik 2020-07-09T12:43:09.371Z

Then re-frame-async-flow-fx does sound like the tool for the job. Apart from that, re-frame has also introduced a thing called global interceptors. So you can create an interceptor that checks if the current event is :a, and if so, dispatches :b.

🎉 1
2020-07-09T13:37:16.374800Z

Thanks a lot!

2020-07-09T14:39:05.381300Z

async-flow-fx uses https://github.com/day8/re-frame-forward-events-fx internally, may be worth taking a look.

p-himik 2020-07-09T06:22:59.355Z

Just dispatch multiple events? Effects are processed right when the corresponding event is finished, so the ordering should be OK.

valerauko 2020-07-09T12:04:48.356300Z

i ran into this funky issue: i use re-frame with shadow-cljs in electron, and i tried to push some hiccup into localStorage (accidentally). until i cleared localStorage the app wouldn't start up saying "no reader for tag object"

valerauko 2020-07-09T12:05:30.356600Z

took forever to figure out what the issue was

2020-07-09T12:07:00.357700Z

Hmm. The component functions in the hiccup might have been the problem?

valerauko 2020-07-09T12:17:59.359400Z

i think it was a pattern regex validation on an input field

valerauko 2020-07-09T12:18:37.360Z

the layers of escaping started to get confusing so i used a cljs regex and i think that was what caused the tag object error

shaun-mahood 2020-07-09T12:37:06.370900Z

General question - would it be desirable to highlight/post re-frame specific job openings in this channel? I know it was something I was looking for (prioritized before general Clojure jobs), but I’m not sure if it would add too much noise or be more annyoing than just putting them in #jobs and #remote-jobs

p-himik 2020-07-09T12:49:38.371200Z

To be honest, I'm a bit surprised to see the "re-frame specific job" phrase at all. :) re-frame is a fairly simple library that won't take much of someone's time to learn if they read the documentation. E.g. I consider HoneySQL to be a much more complex library, but I doubt anyone puts it in the requirements list of a job opening.

Jacob Emcken 2020-07-09T13:40:41.375500Z

I'm trying to generate at preview of a CSV file prior upload. I'm using the node lib papaparser which reads a file object from the event fired by <input type="file" ...> My trouble starts when confronted with papaparser parsing the files async which means that reg-event-db is not the right way to go... but then what?

p-himik 2020-07-09T13:45:59.375600Z

You can probably put everything that calls papaparser into its own effect handler. You'd use that effect to start the parsing process, and the effect handler would itself dispatch some other event when the preview data is ready.

2020-07-09T13:46:26.375900Z

Over the last 4 years, I've seen maybe 20 jobs asking specifically for ClojureScript and re-frame knowledge.

2020-07-09T13:47:01.376200Z

Probably more

Jacob Emcken 2020-07-09T13:47:34.376400Z

so extending cofx with a different handler than those like dispatch and db etc.?

2020-07-09T13:48:34.376600Z

@shaun-mahood I think probably in #jobs is best

shaun-mahood 2020-07-09T13:51:16.379900Z

Sounds good! @p-himik For me, looking for a re-frame specific job was all about avoiding complexity - I wanted something on the front end, and didn’t want to have to work with anything else if I could help it :)

p-himik 2020-07-09T13:53:08.380100Z

@mikethompson Huh. Well, I am surprised. Despite of how useful and well thought out re-frame is, I would not require any candidate to possess the knowledge of it. @shaun-mahood Ah, I see - looking for a re-frame specific job is something else entirely. I was thinking of companies requiring candidates to know re-frame.

p-himik 2020-07-09T13:54:35.380300Z

cofx == co-effects == input for event handlers fx == effects == output of event handlers I was talking about the latter. Yes, something like

{:papaparse {:data ..., :on-complete [:my-event]}}

Quentin Le Guennec 2020-07-09T15:12:19.382200Z

Hello, can I track the cache invalidation of a re-frame suscription?