Fork me on GitHub

Iā€™m having some trouble understanding how to write async coeffect-handlers (e.g. loading some data from a server)? Am I misunderstanding the intended purpose?


There can be no async coeffects. But there can be async effects that load the data and put it into app-db.


OK, thanks:)

Joni Hiltunen20:05:15

Is it normal that when adding or changing effect handlers, everything stops working with hot code reloading until I refresh the page?

Joni Hiltunen20:05:23

Now I'm worried šŸ˜„ I wonder how to debug this


Your problem definition is very vague so I can't really give any hints.

Joni Hiltunen21:05:52

Hmm, actually it's just the navigation bar that stops working... rest of the app seems to function fine

Joni Hiltunen21:05:47

I'm pretty much doing what the re-frame template does for navigating when you make the template with the option +routes

Joni Hiltunen21:05:57

The event still shows up in the debugger view (can't remember if this was re-frisk or the other one) but nothing seems to happen... the db doesn't get updated with the new panel


If you spend a significant amount of time on it without any progress, create a repo with a minimal reproducible example and with the exact steps I need to do to reproduce the issue, and I'll take a look.

Joni Hiltunen21:05:48

hmm, alright. I'll see if it happens with a fresh from template app. Because pretty sure I'm dispatching the navigate event the same way as in the examples

Joni Hiltunen21:05:52

I wonder if it's my system or the template or what

Joni Hiltunen21:05:25

I tested with Chromium and Firefox and it happens in both for me


Use defonce when defining history instead of def.

Joni Hiltunen10:05:18

Amazing! Thanks. Should I submit an issue or a pull repo (not sure I know how) for the template?


When your code gets hot-reloaded, the routes namespace is re-evaluated, so with (def history ...) you create a new history object each time it's re-evaluated. But you don't call start! then, so pushy ends up using a new history that hasn't been used in start!.


> Should I submit an issue or a pull repo (not sure I know how) for the template? Sure! I think it makes sense. First an issue and then a PR for that issue.

Joni Hiltunen10:05:24

should be a trivial change if I know where to find the code in the template thing šŸ˜„ thanks again

šŸ‘ 3

PR merged to re-frame-template and released. Thanks for debugging/fixing the issue @U2FRKM4TW @UQDFC6V4Z :thumbsup: