Repository navigation
Changing top level dynamic segments while preserving others - #39
kellyselden wants to merge 1 commit into
Conversation
|
Would changing a top level dynamic segment cause all the child routes to refire their model hooks, as if you had directly transitioned to that leaf route? |
|
I'm not sure. Perhaps if possible not refire the model hooks of unchanged segments. I'm not familiar with the complexities of the router. |
There was a problem hiding this comment.
This line should probably be something like this.transitionTo('locale.product.item', {, right?
There was a problem hiding this comment.
You are right. Although I would assume a resource reset after locale. How about this.transitionTo('product.item', {?
There was a problem hiding this comment.
Hmm. I think i was thinking that this was a nav component action that would be handled by the locale or application route. So in that case, currentRouteName was assumed to be always calculated.
The following example this.transitionTo('item', { was "I want to look at this same item in a different product's context", so the route would be static.
|
This was reviewed by the core team today. When the child routes are data-dependent on the parent route, this new option creates a footgun. It is incorrect to try to swap the parent route's value without rerunning all the children. When the child routes are not data-dependent on the parent route, we consider it a bug that any expensive rerendering is done, and we think Glimmer plus the ongoing routable component work should address those bugs. We agree that there is still a need for a public API that makes it easier to transition to the existing URL with only one segment changed, and would welcome suggestions for that API. Most likely it should go on the routing service. |
@ef4: A suggestion to that effect: Today through One idea for implementation: the current Example usage: this.paramsFor('locale').set('locale', 'en-gb');
this.paramsFor('products').set('product_id', 2);This approach averts the concern @igorT raised in the issue by requiring the route name be specified in addition to, but separately from, the segment/parameter name. Drawbacks:
(edited to remove statement about |
|
Can't That's a very natural approach to correcting typos in urls - e.g. wrong casing of usernames - this would even work automatically. The downside is that you can't generate a proper link to a different locale, just something that triggers an action... |
|
Given the seven(!) years of inactivity on this issue I think it's fair to close it. The last relevant state was the core teams conclusion:
If someone wants to make an RFC for this specific part then I believe that would still be welcome. |
RFC