re-frame

Jose Vargas 2025-12-17T06:06:29.129829Z

Hi, just trying to grok reframe, some Qs: 1. Are all handlers just some kind of interceptor? 2. Is the only difference between the cofx and the fx the convention that the cofx comes before the event handler, and the fx comes afterwards? 3. Is it good practice to handle async operations (such as http fetch requests) through reframe fx?

p-himik 2025-12-18T09:04:09.357419Z

Yes, you are correct.

😇 1
Jose Vargas 2025-12-18T09:05:26.533149Z

tyvm :]

p-himik 2025-12-17T18:46:42.858469Z

1. Handlers are functions, but internally in re-frame they're wrapped with an interceptor that calls them. The impl is pretty straightforward to follow 2. I'd say it's the reverse, in a way - the only common thing between cofx and fx is that they're both maps with keyword keys. And the cofx map has the :db key, while the fx map might or might not have it 3. Yes

⭐ 1
Jose Vargas 2025-12-18T06:32:49.289289Z

Thank you @p-himik, If the :db effect is not created in the context map, this means that :db stays the same, correct? I was wondering if this might mean that :db is emptied, but it seems that the lack of :db means that the underlying atom (`ratom`?) that holds the data will simply not be reset! . per line: https://github.com/day8/re-frame/blob/1ed85ebae9bd611cfc97b2b66e8df9969f672616/src/re_frame/fx.cljc#L55 (seems some questions are better answered by the code than the docs)

Jose Vargas 2025-12-18T07:44:02.231669Z

However, when using reg-event-db this does not hold true, returning nothing would create a nil value that gets stored in the :db key. per line: https://github.com/day8/re-frame/blob/1ed85ebae9bd611cfc97b2b66e8df9969f672616/src/re_frame/std_interceptors.cljc#L96 Seems correct? Hopefully I am finally getting it.