ember.js icon indicating copy to clipboard operation
ember.js copied to clipboard

test: add failing test around `replaceWith` and `refreshModel`

Open alexlafroscia opened this issue 5 years ago • 1 comments

I've been trying to see if I can bet to the bottom of what is going on in #18416. I figured I would start with a failing test and work backward from there, but I couldn't get very far before hitting a different failure altogether.

I don't intend to land the test in this partial state, but hope that this can be a starting place for actually fixing this bug.

I want want the test to verify is that, when calling replaceWith in afterModel, the router does not unintentionally push a new state into the history stack, which is what actually happens. However, before I can even get to that kind of assertion in the test, I run into this error:

Screen Shot 2020-08-12 at 5 11 23 PM

(Screenshot from an ember twiddle I created to make sure that this error was actually happening in a "real" Ember app and not just the test suite. The test suite will fail with the same error.)

What appears to be happening is that the Transition object is created without any routeInfos

https://github.com/tildeio/router.js/blob/d885da22340da98dcadb45427766efade54ce832/lib/router/router.ts#L123-L130

but then those routeInfos are passed around to a number of functions that expect them to exist as a side-effect of calling finalizeQueryParamChange.

I am going to assume that this is a fix that will need to at least start in router.js and then continue through to here, but figured I would at least post this PR as some small step toward getting to an actual fix.

alexlafroscia avatar Aug 12 '20 21:08 alexlafroscia

Is this still relevant?

kategengler avatar Dec 12 '23 16:12 kategengler