[BUGFIX] Reset sticky query params with an explicit empty query hash - #21522
Closed
olenderhub wants to merge 1 commit into
Closed
[BUGFIX] Reset sticky query params with an explicit empty query hash#21522olenderhub wants to merge 1 commit into
olenderhub wants to merge 1 commit into
Conversation
Allow LinkTo `@query={{(hash)}}` and `{ queryParams: {} }` to restore
destination-route defaults for that transition, while omitting query
params preserves stickiness. Reset hydrates defaults and does not clear
the sticky cache for other routes.
Apps that used an empty query object as a no-op placeholder may observe
a behavior change.
Closes emberjs#20211
Contributor
|
Thanks for submitting this PR! however, while I understand the desire to fix #20211, and have an ergonomic way to solve the problem, we can't change this behavior because it would be a breaking change <3 I'm going to close this for now, as we have several techniques for resetting QPs already, and with a new route/router manager(s) on the way, we want to provide folks more ergonomic ways to customize their route/router behavior |
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.
Summary
Sticky query params are preserved when
@query/queryParamsis omitted. There was previously no clean way to reset them without knowing every QP key.An explicitly empty query object now resets to defaults for that transition:
<LinkTo @route="photos" @query={{(hash)}}>→ defaultsrouter.transitionTo('photos', { queryParams: {} })→ defaults@query/queryParams→ sticky unchanged{ queryParams: { page: 1 } }updates only supplied keys (not a full reset)Reset hydrates defaults for the destination transition; it does not clear the sticky cache for other routes.
Compatibility: apps that used
{ queryParams: {} }/ an empty@queryhash as a no-op placeholder may observe a behavior change, because empty now means reset to defaults.Closes #20211