This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-13
Channels
- # beginners (28)
- # boot (3)
- # clara (9)
- # cljs-dev (127)
- # clojure (82)
- # clojure-belgium (3)
- # clojure-italy (7)
- # clojure-russia (2)
- # clojure-spec (4)
- # clojure-uk (2)
- # clojurescript (351)
- # data-science (3)
- # datascript (1)
- # datomic (24)
- # fulcro (15)
- # jobs (3)
- # juxt (16)
- # off-topic (2)
- # onyx (18)
- # parinfer (1)
- # pedestal (3)
- # perun (6)
- # re-frame (14)
- # spacemacs (20)
Wow, that was fun. Turns out your callback won’t be called unless the target namespace requires cljs.loader
…even though it doesn’t use it
Dynamic routing demo just pushed on develop! Documentation pending, but this will make it much easier to code-split applications with very little effort
I think I might have a little more work to do on the routing tree, but at least the basics are there. This is not production ready yet 😉
OK, I fixed it up a bit more. DynamicRouter should be working on 1.0.0-beta8-SNAPSHOT. See the demo for documentation and a working example. Dynamic and normal UI routers should work with each other, and should be able to be nested. If a route requires more than one thing to be loaded, it should also work. The nesting is untested, but the code for it is rather small and uses the same code path as the unnested case.
Added a demo to beta8 (develop) that shows how to use defrouter
as a detail screen for heterogenous object selection
Is there a easy way to have access to the fulcro-router
current page, in a component ?
(defui ^:once Header
static om/IQuery
(query [this] [{[:fulcro.client.routing.routers/by-id '_] [{:page-router [:current-route]}]}])
Object
(render [this]
(let [current-route (get-in (om/props this) [:fulcro.client.routing.routers/by-id :page-router :current-route])]
)
@claudiu That is the best way if you want to look at it directly. Routes are somewhat of a denormalized thing, in that if you’re using HTML5 routing you have the “current page” in the URI
I mean, you could create a graph edge in your database that points to the router in your header object
The router has a query and ident. You could just put the ident in your header’s initial state, and the query into your query. The the router would appear locally in props without the link query.
Just as a note to those playing with the dynamic loading stuff: I’ve been having a discussion on the clojurescript channel about some problems I’m seeing. It looks like the design for module loading is slightly busted, and will be changing slightly. Never hurts to have real code being written against it to find issues 🙂 The stuff I’m building in Fulcro should isolate you from those concerns, but it does mean that any dynamic loading stuff is going to be of alpha quality and a little unstable until they get it fixed completely in the compiler.