ember.js
ember.js copied to clipboard
[Bug] Cannot read properties of undefined (reading 'shouldSupersede')
๐ Describe the Bug
When calling routerService.urlFor(...)
the call throws the following error:
TypeError: Cannot read properties of undefined (reading 'shouldSupersede')
at NamedTransitionIntent.applyToHandlers (http://localhost:4040/assets/vendor.js:58167:52)
at NamedTransitionIntent.applyToState (http://localhost:4040/assets/vendor.js:58109:19)
at PrivateRouter.generate (http://localhost:4040/assets/vendor.js:59134:26)
at Router.generate (http://localhost:4040/assets/vendor.js:18718:38)
at RouterService.urlFor (http://localhost:4040/assets/vendor.js:15630:27)
at CatchAllRoute.urlForRouteInfo (webpack://cargo/./node_modules/ember-error-route/index.js?:84:24)
at CatchAllRoute.serialize (webpack://cargo/./node_modules/ember-error-route/index.js?:60:21)
๐ฌ Minimal Reproduction
- Clone https://github.com/rust-lang/crates.io/pull/4659
- Run one of the failing tests
๐ Actual Behavior
The error page does not work properly.
๐ค Expected Behavior
The call does not fail and the error route is displayed correctly.
๐ Environment
- Ember: 4.3.0 (works fine in 4.2.0)
- Node.js/npm: irrelevant
- OS: irrelevant
- Browser: irrelevant
โ Additional Context
This is most likely related to the changes that were introduced in https://github.com/emberjs/ember.js/pull/19971
/cc @wagenet
Ouch! Looks like we need more tests here. If youโre able to add some that would help speed up the debugging process.
We're seeing this in 3.28 fwiw, but the trigger for us is a LinkTo
with query params.
I have the same problem and could solve it by providing @models
to LinkTo
.
For example:
<LinkTo @models={{array this.model}} @query={{hash state=@state page=1}}>Label</LinkTo>
@meirish if youโre seeing it on 3.28 itโs probably a different specific bug. Can you create a new issue and a minimal reproduction? That would be super helpful.
@fsmanuel is that on 4.3+ or an earlier or later version where it first appears?
(Working on chipping away at this issue this week!)
@chriskrycho if i recall it correctly it started with 3.27 and still persists in 3.28 Haven't updated to 4.x yet
Thanks! As with @meirish's bug that's almost certainly a different bug than the one identified in this issue; if you can create a minimal reproduction that would be helpful. Thanks!
@chriskrycho ah you are right. I'll see what I can do.
I left a comment suggesting that we might have to revert #19971, but on digging further, I don't think that code path and this one intersect at all. It seems likelier that it's a result of the router.js refactors that landed in between. Investigating that now.
It is indeed the result of the router.js work; tildeio/router.js#329 introduced a bug which was fixed by tildeio/router.js#334, which we actually have on the beta branch via #20166โIโve tested that change (by editing node_modules
in the crates.io
repo :joy:) and it does indeed resolve it. I'll see if we can get the back-ports out tomorrow and this should be unblocked. ๐
sweeeeeet! thank you, Chris! โค๏ธ
@Turbo87 if you can confirm once Renovate bumps that PR to use 4.7.1, I think we can close this out, as I published 4.4.3 LTS and 4.7.1 stable an hour ago! ๐
I can confirm that CI is green now. thanks again!
I have just migrated from Ember's LinkTo
to our own Link
component, (the exact same signature as LinkTo
). Which hands off to the router service's urlFor
method.
Since then, TypeError: undefined is not an object (evaluating 'f.shouldSupersede')
has been showing up in our Sentry logs.
Ember ~5.5.0
stack
TypeError: undefined is not an object (evaluating 'f.shouldSupersede')
at applyToHandlers(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:3230:105)
at generate(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:3311:67)
at generate(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:1637:36)
at ke(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:650:73)
at ? (/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2154:42)
at ? (/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2780:6)
at d(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2154:20)
at Je(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2448:64)
at flush(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2443:69)
at ? (/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2379:14)
at evaluate(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2272:21)
at evaluateSyscall(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2560:69)
at evaluateInner(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2554:153)
at evaluateOuter(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2554:72)
at next(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2615:39)
at _execute(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2614:29)
at handleException(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2565:77)
at handleException(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2580:599)
at throw(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2563:185)
at evaluate(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2369:34)
at _execute(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2563:22)
at execute(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2561:110)
at rerender(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2581:39)
at ? (/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:454:37)
at Dt(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2550:6)
at _renderRoots(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:453:34)
at _renderRootsTransaction(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:458:22)
at _revalidate(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:460:314)
at invokeWithOnError(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2910:200)
at flush(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2902:75)
at flush(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2915:212)
at _end(/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2972:14)
at ? (/a/ember/assets/vendor-2fe8c9a84ed109415b3e52cfec8f2a77.js:2924:609)
Linking https://github.com/emberjs/ember.js/issues/20663, in case its related.