Fork me on GitHub
#re-frame
<
2020-08-16
>
mikethompson02:08:24

@marcus.akre be careful with that approach. See the FAQ entry on Laggy Inputs

Marcus08:08:58

@mikethompson Ah thanks! Didn't know that would be a problem. One of the proposed solutions is to switch to use dispatch-sync. I guess that could work if it is not used too much.

Casey14:08:01

All the examples and small projects I've seen tend to group events, subs, and fx in one file... or one file for events, one for subs, etc. How do real-world larger projects handle this? I can see on events ns getting really huge

p-himik14:08:09

Initially, I split into files that deal with a single "piece" of the app, however you define it. When one such file becomes unwieldy, I split it into smaller chunks. Usually a file per component. So I might start with something like main_page.cljs and end up with something like login_form.cljs, navbar.cljs, items_table.cljs, and so on.

Casey16:08:09

Do you group -db , -event-fx, -fx and, -subs together by "piece"/ "action" or by type (e.g., all subs together, all fx together, etc)?

p-himik16:08:50

Nope, I don't see the point of grouping by these things. Otherwise, it would also make sense to group def and defn separately, and we don't do that. Also, suppose you have a sub like :app/my-value. And you have an event :app/set-my-value. Why would you ever split them? Unless you want to have to change multiple sources if you ever decide to change how the value is actually stored.

manutter5116:08:00

I use a hybrid approach: separate, top-level namespaces for subs, events and db for things that are global/application-wide, and then individual namespaces for specific components, with db, subs, and event handlers as sections within the namespace.

p-himik16:08:08

Oh, right - I use top-level nss as well for some things.

pcj00:08:13

Adding on, I take the same approach as manutter51. Sometimes I will even create a some-page directory that splits the subs, events, views, etc. into separate files if the page has a lot going on... like a dashboard with lots of widgets. But generally, a certain “fragment” of the application in my experience can contain everything (and probably should).