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
sandbags 2020-08-06T11:38:14.220900Z

In the re-frame docs (http://day8.github.io/re-frame/Effects/) it refers to "`re-frame's` built-in effect handlers, like `dispatch-n` and `dispatch-later`, are detailed in https://day8.github.io/re-frame/codox/ document." But on that page I see defined only dispatch and dispatch-sync . What am I missing?

sandbags 2020-08-06T11:41:21.221500Z

Actually I am not sure that codox page is working. None of the links do anything for me (Chrome 84, macOS 10.14.6)

sandbags 2020-08-06T11:43:51.222500Z

I'm trying to remember how one should dispatch events from an event handler. I suspect using dispatch-async directly is counter-indicated and you should be using reg-event-fx and having something else trigger the dispatch but I can't seem to find it in the docs.

sandbags 2020-08-06T11:45:35.222600Z

Found it, in the Effects: Two Step Plan section, returning {:dispatch […]}

sandbags 2020-08-06T11:51:02.222800Z

It seems like either {:dispatch []} is an example not implemented or there is magic functionality that makes it work not documented. For example if I want do dispatch two events as a side-effect, can I :dispatch [[evt1][evt2]]?

sandbags 2020-08-06T11:59:05.223Z

Okay have found what I need in fx.cljc

2020-08-06T12:56:41.223400Z

@sandbags Sorry, that link on that page is old and wrong (now corrected). This is the link you should be using ... https://day8.github.io/re-frame/api/#api-builtin-effects.html

2020-08-06T12:57:38.224400Z

It seems like you might want effects like this:

{ :db         (assoc db :something :else) 
  :dispatch-n (list [:first-event] [:second-event "yeah"])}

2020-08-06T12:58:40.225Z

^^^ note that's :dispatch-n and not :dispatch

sandbags 2020-08-06T13:09:32.225900Z

Thanks @mikethompson I eventually ended up spelunking into fx.cljc but grateful for the confirmation. I've been away from re-frame too long!

2020-08-06T13:10:24.226100Z

Glad to have you back :-)

😀 1
Grant Isom 2020-08-06T15:26:09.227400Z

In our project, our views.cljs is growing pretty fast, are there any patterns or naming conventions for moving to a views folder then having files for each page or group of components?

2020-08-06T15:28:05.229200Z

I usually write a namespace for components that will work together. Similar to the hexagonal architecture.

2
sandbags 2020-08-06T18:09:09.230400Z

Okay, I'll bite. Hexagonal architecture is a new one on me… where can I find out more?

2020-08-06T18:17:57.231900Z

It just means that you will write many fully qualified events and subs, and only few of them will be global and shared.

Jose Varela 2020-08-06T18:37:23.232200Z

I had heard of this in another context, is it the same? https://netflixtechblog.com/ready-for-changes-with-hexagonal-architecture-b315ec967749