Fork me on GitHub
#fulcro
<
2017-08-13
>
tony.kay01:08:42

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

tony.kay01:08:07

I’ve verified this is an expected behavior. Not too excited about that

tony.kay01:08:58

Dynamic routing demo just pushed on develop! Documentation pending, but this will make it much easier to code-split applications with very little effort

tony.kay01:08:33

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 😉

tony.kay02:08:28

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.

tony.kay04:08:27

Added a demo to beta8 (develop) that shows how to use defrouter as a detail screen for heterogenous object selection

claudiu09:08:52

Is there a easy way to have access to the fulcro-router current page, in a component ?

claudiu09:08:13

So far this is the only thing that I came up with that works:

claudiu09:08:16

(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])]
     )

tony.kay18:08:02

@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

tony.kay18:08:55

I mean, you could create a graph edge in your database that points to the router in your header object

tony.kay18:08:02

they your query would be nicer

tony.kay18:08:46

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.

tony.kay20:08:23

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.

claudiu07:08:00

thank you for sharing. Really interesting chat on clojurescript channel 🙂