Skip to content

[BUGFIX] query params trigger model refresh unnecessarily - #21409

Merged
NullVoxPopuli merged 2 commits into
emberjs:mainfrom
olenderhub:tests/router-service-transitionto-unchanged-qps
Jul 10, 2026
Merged

[BUGFIX] query params trigger model refresh unnecessarily #21409
NullVoxPopuli merged 2 commits into
emberjs:mainfrom
olenderhub:tests/router-service-transitionto-unchanged-qps

Conversation

@olenderhub

Copy link
Copy Markdown
Contributor

This adds regression coverage for the behavior described in #19497.

The tests cover both route-name transitions and URL-string transitions with RouterService#transitionTo, and verify that the parent route's model hook is not re-run when transitioning to a child route with unchanged query params.

This contributes to the routing test coverage work tracked in #19609.

Refs #19497
Refs #19609

this.add(
'controller:parent.child',
Controller.extend({
queryParams: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this config go on the route?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NullVoxPopuli Thank you for this comment. I am sorry, I didn't reproduce this properly, so these tests passed. I pushed code with I believe proper reproduction of your twiddle code #19497 (comment), then I noticed this issue still exit, so I also pushed proposition of fix to this problem. After this pnpm run test:wip passing. Please check it again

@evoactivity evoactivity left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also close #16349

@NullVoxPopuli

This comment was marked as off-topic.

…params

Add two tests verifying that RouterService#transitionTo does not re-run
the application model hook when transitioning with unchanged query params
- one using route name, the other using URL string.
- Skip model refresh when query param serialized value matches the
  last finalized value, preventing spurious refreshes during sticky
  QP hydration or URL transitions with unchanged default values
- Fixes regression where transitionTo with same-valued application
  query params and refreshModel: true would abort the transition
@NullVoxPopuli
NullVoxPopuli force-pushed the tests/router-service-transitionto-unchanged-qps branch from a065381 to 6aa46e2 Compare July 10, 2026 18:53
@NullVoxPopuli NullVoxPopuli changed the title Add regression tests for RouterService transitionTo [BUGFIX] query params trigger model refresh unnecessarily Jul 10, 2026
@NullVoxPopuli
NullVoxPopuli merged commit d0b57f0 into emberjs:main Jul 10, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants