This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-21
Channels
- # 100-days-of-code (1)
- # announcements (2)
- # beginners (164)
- # cider (23)
- # cljs-dev (30)
- # cljsjs (11)
- # cljsrn (7)
- # clojure (116)
- # clojure-boston (1)
- # clojure-dev (20)
- # clojure-finland (2)
- # clojure-italy (4)
- # clojure-nl (1)
- # clojure-uk (10)
- # clojurescript (39)
- # core-async (19)
- # cursive (43)
- # data-science (2)
- # datomic (24)
- # emacs (10)
- # figwheel-main (20)
- # fulcro (63)
- # hoplon (7)
- # hyperfiddle (7)
- # instaparse (3)
- # kaocha (1)
- # nrepl (3)
- # off-topic (170)
- # onyx (13)
- # other-languages (3)
- # parinfer (13)
- # re-frame (39)
- # reagent (5)
- # reitit (22)
- # ring-swagger (4)
- # shadow-cljs (284)
- # spacemacs (2)
- # sql (27)
- # testing (28)
- # unrepl (2)
0.2.8 Reitit For some reason Swagger generation fails in situation when response body is vector containing data-spec. Generating data spec with ds/spec works fine so syntax should be legal. Is this bug or a feature?
@heikki.hamalainen it seems that the reitit.coercion.spec/IntoSpec
is missing a mapping for vectors/sequences. PR welcome.
https://github.com/metosin/reitit/blob/master/modules/reitit-spec/src/reitit/coercion/spec.cljc#L44
Great 🙂 maybe I can make this.
@ikitommi PR ready for inspection https://github.com/metosin/reitit/pull/182
In the [initial blog post](https://www.metosin.fi/blog/reitit/) you mentioned a re-frame helper module. Where can I find this?
@urzds re-frame helpers haven't been published, but the controllers are part of reitit-frontend
, here's a sample app (with reagent): https://github.com/metosin/reitit/blob/master/examples/frontend-controllers/src/frontend/core.cljs
@ikitommi :start
and :stop
are functions that will be called when browsing to a route / page and when leaving it again?
yes, the docs are kinda missing, but all the source code for controllers is in here: https://github.com/metosin/reitit/blob/master/modules/reitit-frontend/src/reitit/frontend/controllers.cljs
So that's where I would put the re-frame/dispatch
in order to trigger the re-frame dominoes to switch the page?
there is also kee-frame, which uses reitit, but with it’s own global controller definitions.
@juhoteperi could explain it better, but the router takes care of page changes, controllers are for preparing data for the page, e.g.
[["/users" {:controllers [load-users]}
["/:id" {:controllers [load-user-by-id]}]]
["/pastas" {:controllers [load-pastas]}]]
, navigating to /users
will ensure that load-users
:start
gets called. going to /users/1
will not reload that, but would call :start
of load-user-by-id
. Going back to /users
will cause :load-user-by-id
to :stop
. Moving to /pastas
from users/1
will :stop
both user-controllers and start the load-pastas
.I think the re-frame helpers could be put into an example, not much code there either.
The callback to router start!
should be used to call dispatch
to change page
There is no reason to write any re-frame helpers
@juhoteperi Could you please explain that some more? Which callback? And dispatch
means re-frame/dispatch
and "change page" means whatever mechanism my application uses to change the page? (e.g. :active-page
in the :db
?)
https://github.com/metosin/reitit/blob/master/examples/frontend/src/frontend/core.cljs#L72
@heikki.hamalainen the vector data-spec fix out in [metosin/reitit "0.2.9"]
, thanks!
There seems to be also in :response handling same kind of presupposition that response is always map -> doesnt allow for example {200 [int?] It seems that in this situation the problem lies in https://github.com/metosin/reitit/blob/master/modules/reitit-spec/src/reitit/coercion/spec.cljc create function which I try to fix this next 🙂
@heikki.hamalainen isn't that {200 {:body [int?]}}
@ikitommi Uups, stupid me. - i didnt have that body key there Forget everything 🙂 Workds fine. Too late - have to go to home.