This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-07
Channels
- # aws (2)
- # bangalore-clj (4)
- # beginners (62)
- # boot (74)
- # cider (408)
- # cljsrn (17)
- # clojure (117)
- # clojure-dusseldorf (1)
- # clojure-russia (21)
- # clojure-spec (17)
- # clojure-uk (15)
- # clojurescript (154)
- # cursive (3)
- # datomic (16)
- # emacs (33)
- # funcool (3)
- # hoplon (99)
- # off-topic (7)
- # om (10)
- # overtone (3)
- # portland-or (1)
- # protorepl (9)
- # re-frame (83)
- # reagent (11)
- # remote-jobs (1)
- # ring-swagger (24)
- # specter (10)
- # untangled (1)
- # yada (11)
@notanon I'd suggest having a read through (see "Notes" on 2nd panel of infographic): https://github.com/Day8/re-frame/blob/develop/docs/SubscriptionInfographic.md And if you want to understand more deeply how it works: https://github.com/Day8/re-frame/blob/develop/docs/SubscriptionFlow.md
@chris.hendricks I'm certainly keen for issue 216 (formal API docs) to be progressed. But it is a bit hard because of the method we used to "promote" impl into the API.
absolutely, I noticed there were some discussions including a macro implementation to get doc strings from the namespaced fns
I think there's a couple of issues we have to get sorted ahead of this one which will change the structure of the code.
you got it, exactly why I asked
thanks for the reply
For example, a resolution to this issue might change everything (in terms of internal code structure): https://github.com/Day8/re-frame/issues/137
@chris.hendricks but I appreciate the offer!! Please keep trying to help :-)
i'll keep an eye out, thanks for a great project
@mikethompson thanks ill check them out
(unrelated to the above)
It is almost like app-db is the temporary place where this imagined perpetual reduce stores its on-going reduction.
Now, in the general case, this perspective breaks down a bit, because of reg-event-fx (has -fx on the end, not -db) which allows:
1. Event handlers to produce effects beyond just application state changes.
2. Event handlers to have coeffects (arguments) in addition to db and v.
Does anyone know what the use cases would be for 2. ? I think the 1. use cases are pretty obvious, effect localStorage or some other non-app-db related effect. But nothing comes to mind for 2.@notanon: in my understanding coeffects is when you have to do impure functions to get an argument
thanks qqq. that makes sense. seems like the 'next' page in the documentation is going into that. maybe i should read everything before asking questions... it seems like everything is already thoroughly documented (...which is awesome)
@mikethompson spent who knows how many hours helping me out
@notanon yeah, i believe the docs cover it. We're talking inputs like: a random number, a GUID, today's datetime, etc.
inputs to an event handler
Which can't be obtained from app-db or the event itself
But also designed with something like DataScrpt in mind
The value in app-db
itself is considered a coeffect. So, if you had alternative data sources, like a DataScript connection, you caould also inject that as a coeffect, making it available to the event handlers
@mikethompson: the default lein template re-frame uses secretary
how is secretary supposed to be used? when I go to a new path, does the app-db get reset, or does the app-db stay the same even as secretary moves around paths?
I don;t have a lot of experience with needs in this area. So I'll defer to others on this. todomvc also uses secretary and may be interesting to you, but the choice is not a strong one. There are other libs out there perhaps better. Dunno.
I don't know either; I was mainly curious since the lein template for re-frame includes secretary by default.
https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/core.cljs#L19-L25
@mikethompson: le tme rephrase my question: why have routing at all?
I'm the wrong guy to ask. We don;t need to support routing in our apps.
But I'm aware it is a big deal for many. So I'll let them chip in.
But it is my understanding that routing does two things for your SPA: 1. It can respond correctly to the back button being pressed 2. Allow for deep linking to certain functionality
3. intercept url changes by the user 4. allow programmatic location changes (insert items into back/forward history)
We can match these routes as before :-
user> (match-route my-routes "/index.html")
{:handler :index}
user> (match-route my-routes "/articles/article.html")
{:handler :article}
and in reverse too :-
user> (path-for my-routes :article-index)
"/articles/index.html"
you'll need to copy/paste the extra bits of browser integration (hooking into google closure history api probably)
when you add +route to the re-frame lein template it uses a place in the app-db to store the "current page" (it's not called that, but thats what it is)
which I still haven't figured out why i need (and re-frame is probably not the right channel to ask)
with bidi the value you're reacting to would be something like
{:handler :article}
and you'd update the url to something like "#/articles/index"
and your view would need to interpret the {:handler :article} as well to decide which components to render
mike mentioned deep linking, bi-directional routing would make it trivial
Now, when we match on an article path, the keyword values are extracted into a map.
user> (match-route my-routes "/articles/123/article.html")
{:handler :article, :route-params {:id "123"}}
user> (match-route my-routes "/articles/999/article.html")
{:handler :article, :route-params {:id "999"}}
@qqq i arbitrarily chose secretary for the template (as opposed to bidi, silk, etc.), and as for why client-side routing i agree with @mikethompson and @notanon. I personally use routing for back button and to let my app know which relevant api calls i should make on page refresh.
For what i use it for, it works great .. i was curious about trying the other libs out, but never had a strong enough itch
However, i have had problem when trying to remove the #
with something like accountant
My specific problem with that lib was back button and query params ... i now just leave the #
in my routes even if its ugly
I have been using client aide routing for all my apps, some have visualizations and the like, but mostly it is just forms and user accounts etc. Still seems like routing is appropriate tho