I would like to have multiple URLs that go to the same component, but I have not found a way to do this directly in the dioxus router. I can do a redirect, but it changes the URL. I want to have separate URLs, they just show the same content. I could create a wrapper component for one of the routes that does nothing but pass the same args to the other component in its rsx, which is certainly a manageable workaround, but I remain curious if this use case is supported in some other approach within the router itself, or expected to be supported in the future. Thanks!
This is especially of interest to me in the context of optional parameters -- the router does not seem to allow for optional params, even tho components allow for it (with Option<...>), and I would like to have different URLs depending on the different params being passed in.
One naive attempted approach:
// redirect works
#[redirect("/oldblog/:id", |id: i32| Route::Blog { id })]
// normal blog route works
#[route("/blog/:id")]
Blog { id: i32 },
// does not compile because this is an enum, we can't list the same value more than once (ofc)
#[route("/otherblog/:id")]
Blog { id: i32 },
But I also cannot do this:
// this compiles but only the first route gets applied to the enum (and how would it even work if it didn't have the same parameters...)
#[route("/otherblog/:id")]
#[route("/blog/:id")]
Blog { id: i32 },
Is there any planned support for optional params, or alternative URLs for the same components, or do I have to just create wrapper components if I want to do either of these?
Thanks!