memory-hole icon indicating copy to clipboard operation
memory-hole copied to clipboard

event handlers are not pure

Open mozinator opened this issue 9 years ago • 1 comments

Event handlers in re-frame should be pure. In the handlers there are side effects created by calling ajax functions.

https://github.com/yogthos/memory-hole/blob/master/src/cljs/memory_hole/handlers/admin.cljs#L15

The re-frame / pure way would be to write an effect handler which handles the execution of the state change. Have a look at the following library to see how this can be solved in a pure way:

https://github.com/Day8/re-frame-http-fx

mozinator avatar Oct 29 '16 18:10 mozinator

Yeah I keep meaning to switch to using those, just haven't had a chance to get around to it. If you're up for doing a PR that would be much appreciated though. :)

yogthos avatar Oct 29 '16 20:10 yogthos