Skip to content

RouterService transitionTo/replaceWith transitions are always aborted when destination has refreshModel queryParams with a default value #20512

Open
@davidtaylorhq

Description

@davidtaylorhq

🐞 Describe the Bug

Given a route which has queryParam configured with refreshModel: true, and with a default value specified (via an identically property on the controller), attempting to transition to the route via the router service will result in an aborted transition. A new transition seems to be created, but the call site has no visibility of it.

e.g. If the call site looks like this:

await this.router.transitionTo("home");
console.log("Transition complete");

the console log will never be written.

Using the deprecated (and under Ember 5.x, removed) routing methods on Controller/Route does not show this issue.

Removing either the default value or the refreshModel configuration seems to avoid the problem.

This behaviour makes it very difficult to migrate away from the deprecated Controller/Route transition methods.

🔬 Minimal Reproduction

See this repository for a minimal demonstration, including a failing acceptance test.

Verbose logging of the problematic transition via the router service looks like this:

Attempting transition to home
Preparing to transition from 'other-page' to 'home'
Starting a refresh transition
Transition #1: home: transition was aborted
Transition #1: detected abort.
Transition #2: Resolved all models on destination route; finalizing transition.
Transitioned into 'home'
Transition #2: TRANSITION COMPLETE.

A successful transition using the legacy Controller.transitionToRoute looks like this:

Attempting transition to home
Preparing to transition from 'other-page' to 'home'
Transition #1: Resolved all models on destination route; finalizing transition.
Transitioned into 'home'
Transition #1: TRANSITION COMPLETE.
Transition completed

🌍 Environment

Reproduced under Ember 3.28 and 4.12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions