Fork me on GitHub
#re-frame
<
2019-09-03
>
scknkkrer04:09:01

What are the idiomatic design of a software in re-frame with routes. I’ve an idea that keeping the view and route informations togerher in a single val. And use them define the routes and rendering them. I think it is clean. But it’s a five minutes idea. How you guys doin’ it in your projects ?

nenadalm17:09:08

and now I just noticed that somebody wrote it in the channel already 🙂

valtteri13:09:42

Here's an example routes.cljs file in my project https://github.com/lipas-liikuntapaikat/lipas/blob/master/webapp/src/cljs/lipas/ui/map/routes.cljs And here's the main routes.cljs that pulls all routes from sub-modules together. https://github.com/lipas-liikuntapaikat/lipas/blob/master/webapp/src/cljs/lipas/ui/routes.cljs I don't know if this is idiomatic but it has been working for me nicely in a non-trivial project.

valtteri13:09:43

I also contributed a simple re-frame example to metosin/reitit repo that you might find interesting. https://github.com/metosin/reitit/tree/master/examples/frontend-re-frame

mccraigmccraig16:09:28

@danielcompton will you take a PR to convert re-frame-test *test-context* from a dynvar-of-atoms to an atom-of-pure-data ? https://github.com/yapsterapp/re-frame-test/compare/atom-state - the dynvar is breaking my tests on clj, because there are promise-based pre-conditions, and wait-for* is getting run on a random thread. all good with an atom-based *test-context*

danielcompton01:09:03

I'm not a maintainer of re-frame anymore, so I couldn't take the PR, but at first blush that sounds like a reasonable change, though would be breaking.

mccraigmccraig03:09:41

oops, who are the maintainers now?

mccraigmccraig03:09:14

i don't think it's breaking ... *test-context* is private

superstructor05:09:46

Thanks, I'll take a look soon :thumbsup:

superstructor05:09:19

Out of interest, how do you think this could be breaking @danielcompton?

danielcompton16:09:24

Ah, I didn't realise *test-context* was public, if it's private then that isn't a problem

superstructor02:09:00

:thumbsup: Thanks.

mccraigmccraig22:09:59

i've just found what i think is a bug in run-test-async ... namely that if a test timeouts then any post-event-callback-fn registered by the wait-for which timed out doesn't get deregistered - and an ever longer list of callbacks builds up

mccraigmccraig22:09:12

one solution would seem to be to add a method to IEventQueue to clear all the callbacks when run-test-async terminates - you happy for another PR with that solution ?

mccraigmccraig16:09:22

(once i've gotten the wait-for logic sorted anyway... seems i broke the re-frame-test tests with wait-for chains 😬)