This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-03
Channels
- # announcements (3)
- # beginners (114)
- # calva (42)
- # cider (90)
- # clj-kondo (3)
- # cljsrn (6)
- # clojure (40)
- # clojure-conj (4)
- # clojure-dev (3)
- # clojure-europe (4)
- # clojure-italy (3)
- # clojure-nl (4)
- # clojure-quebec (1)
- # clojure-spec (3)
- # clojure-uk (130)
- # clojurescript (31)
- # cursive (3)
- # data-science (3)
- # datavis (1)
- # datomic (5)
- # dirac (3)
- # fulcro (16)
- # jobs (1)
- # joker (6)
- # music (5)
- # off-topic (14)
- # re-frame (19)
- # remote-jobs (8)
- # shadow-cljs (37)
- # slack-help (4)
- # tools-deps (22)
- # xtdb (8)
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 ?
I have routes in one place and case
to select view in totally different place.
It can be seen in my toy project:
- https://github.com/nenadalm/Warehouse/blob/721b17f24cc545e44a5bbb101d69f13f203a339e/frontend/src/warehouse/routes.cljs#L10
- https://github.com/nenadalm/Warehouse/blob/721b17f24cc545e44a5bbb101d69f13f203a339e/frontend/src/warehouse/views.cljs#L27
I consider having them together in future though. Example can be seen in reitit examples: https://github.com/metosin/reitit/blob/ca7403ccab11b53c223c758209bda7fca85fee6f/examples/frontend-re-frame/src/cljs/frontend_re_frame/core.cljs#L80
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.
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
@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*
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.
oops, who are the maintainers now?
i don't think it's breaking ... *test-context*
is private
Thanks, I'll take a look soon :thumbsup:
Out of interest, how do you think this could be breaking @danielcompton?
Ah, I didn't realise *test-context*
was public, if it's private then that isn't a problem
:thumbsup: Thanks.
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
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 ?
:thumbsup:
(once i've gotten the wait-for
logic sorted anyway... seems i broke the re-frame-test tests with wait-for
chains 😬)
logic sorted. tests pass: https://github.com/Day8/re-frame-test/pull/16