Fix/router child dynamic prefix pr#5655
Open
rjharmon wants to merge 3 commits into
Open
Conversation
* widen ChildRouteMapping.format_route_as_root_route to Arc<dyn Fn> * add parse_route_via_chain helper for depth-2+ child router chains * add format_route_via_chain helper, symmetric to parse_route_via_chain, so format-side closure composition walks through multiple outer ChildRouteMapping<R> mappings at depth 3 or more * walk parent dynamic segments before delegating to child::from_str, preserving DioxusLabs#5613's raw_query and raw_hash forwarding * emit catch-all writes through a Display wrapper so #[child("/:..rest")] composes with children that have only query or hash specs * drain catch-all without consuming the source segments iterator
* parsing: dynamic-prefix child round-trip via to_string, including a percent-encoded value subcase * parsing: dynamic-prefix child preserves the query channel * parsing: dynamic-prefix child preserves the hash channel * parsing: catch-all parent composes with query-only child * parsing: catch-all parent with typed element type round-trips * parsing: typed parent dynamic segment surfaces parent parse error * via_ssr: render under dynamic parent prefix * via_ssr: depth-2 chain preserves the deepest dynamic, and Link href captures parent dynamic at depth 2 * via_ssr: depth-3 chain preserves the deepest dynamic two hops down * via_ssr: depth-3 Link href captures both parent dynamics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#[child]with dynamic prefixes and depth-2+ chainsIntent
Make
#[child("/path/:dyn")]and multi-level#[child]composition work end-to-end at parse, render, andLinkhref generation.#[child("/path/:dyn")]: parent dynamic-segment values now round-trip through parse, render, and Link href correctly.Linkhrefs.#[child("/:..rest")]composes with children that carry only query or hash specsApproach
Preserves PR #5613's query/hash forwarding and PR #4994's child-router layout shape; layered on
top of both. Backstory:
Implementation changed so the parent route's (dynamic) segment definition are consumed via the
nested try_parse chain first, and child::from_str(&trailing) runs only after segments has been
advanced to the child's tail.
test notes
Linkhref exercises theArc<dyn Fn(R) -> String>widening: the emitted closure move-captures the parent's dynamic-segment values.Linkhref exercisesformat_route_via_chain<R>, which walks any outerChildRouteMapping<R>chain. The multi-level composition the depth-2 test cannot reach.