How could I get a form route's path to have multiple parts? e.g. item/<id>/<sub-id>? I'm trying to go with something like :route-segment ["item" :action :id :sub-id] and a custom :will-enter, and while the query is executing correctly, the form fails to render (blank page).
Seems the only way I'm able to accomplish this is by changing the https://github.com/fulcrologic/fulcro-rad/blob/fc63e640c8256e717c5f3d934fa55b903e2a1d3a/src/main/com/fulcrologic/rad/form.cljc#L567 impl. to include the :sub-id like so:
route-prefix (merge {:route-segment [route-prefix :action :id :sub-id]
:allow-route-change? form-allow-route-change
:will-leave (fn [this props] (form-will-leave this))
:will-enter (or will-enter
(fn [app route-params]
(form-will-enter app route-params (get-class))))})So, I’ve done my best to give reasonable extension point/overrides for everything in RAD, including the fact that a form or report is just a regular Fulcro component that has pre-written stuff on it. The macros are just for convenience, but you can make your own form/report macros that steal whatever you find useful from the built-ins and emit what you want. I didn’t do the best job of giving you reusable macro elements, but there are quite a few helpers (like form-allow-route-change) that you can leverage. So yeah, if you want to change something as central as the format of the route, you’d have to take control at that more core level
Thanks @tony.kay. A lot of the time it's a matter of me wondering if I'm just misusing the thing or missing something that's built in already, because you do have so many useful little levers in the system. After that, it's wondering where the most correct place of extension/override is to add the functionality I'm looking for if it isn't something natively supported. Like in this case, I know I could do a simple one-off override in the new-html5-history, but maybe it could be more simply implemented by manipulating the fo/machine? Not sure. Maybe it's a matter of taste. As for the macros - I haven't really written my own macros in Clojure, even though macros are a main part of the value prop of lisps... it's just not something I've integrated into my tool bag yet.
Yeah, you could probably get that one working right with fo/machine, now that you mention it