fulcro

sheluchin 2025-05-09T16:33:37.066469Z

Separate question: can anyone suggest how to generate a sitemap for a RAD project?

sheluchin 2025-05-13T12:56:59.131999Z

Thanks, that makes perfect sense. Just construct the map from the component tree that you can pull from the root.

tony.kay 2025-05-13T13:25:57.844079Z

well, the AST of the query of the root component, yes

tony.kay 2025-05-13T13:26:14.205989Z

which exposes the stateful component tree

sheluchin 2025-05-13T13:28:42.202539Z

But it won't produce every possible route, right? You'll need to incorporate some data you produce separately in order to get all the routes? For example, if you have some search functionality that pulls ids from a backend DB that don't exist in some report component, you'll need to pull those ids separately and add them to the tree you construct from the AST.

tony.kay 2025-05-13T13:29:46.531369Z

well certainly if there are dynamic elements to your routes that you want in your site map then yes you’re going to have to add those separately

tony.kay 2025-05-13T13:30:17.027169Z

but for the most part you don’t include every possible route in a site map…like “The form to edit employe 45722” is silly 😄

sheluchin 2025-05-13T13:34:51.106769Z

Indeed 🙂 yep, okay, I think I get the big picture for how this would work in theory. Hmm, just relating it to my previous question about multi-part URL paths (e.g. combining two props in the URL like thing/<id>/<sub-id>), is this approach of reading the AST going to work with modifications to the html5-history or does it need to be baked into the router? Those two things are decoupled, I know, but somewhere along the way it needs to come together to produce a sitemap properly.

tony.kay 2025-05-14T00:49:52.878379Z

I’m just telling you that you can find everything via the query and looking at component options. The route segment is one of those options. You’re going to have to figure out the actual data transform.

sheluchin 2025-05-14T00:55:16.268879Z

Got it. Thanks Tony, I'll figure it out with the advice you've shared.

tony.kay 2025-05-09T19:02:55.657899Z

The whole design of dynamic routing is that the components end up in the query, so that you can compose things and have everything (including the map of possible routes) be represented by the UI composition. So, if you pull the Root query, and turn it into an AST, then you’ll have all of the components at each node (:component key). If it is a router, then the component-options will tell you the targets, etc. So, it’s just a data extraction task.

tony.kay 2025-05-09T19:03:15.608089Z

Add whatever keys you want in the route target components to help with things like labeling

tony.kay 2025-05-09T19:03:53.645769Z

E.g. if a target was given your own :route-label "Foo" as you traverse the routing tree you can pull that from the targets with component-options as well