Closed buschtoens closed 5 years ago
While working on https://github.com/ember-engines/ember-engines/pull/642 to make ember-engines compatible with Ember Octane, I noticed that https://github.com/emberjs/ember.js/pull/17772 appears to have broken an edge case for <LinkTo> without a @route argument, but with a @query argument.
<LinkTo>
@route
@query
I made a reproduction here: https://codesandbox.io/s/p32ozvvz0x
If no explicit @route is passed it will be set to (or remain) UNDEFINED:
UNDEFINED
https://github.com/emberjs/ember.js/blob/2cc35738f2938e6b9735d0d641214b0721d53a4b/packages/%40ember/-internals/glimmer/lib/components/link-to.ts#L895-L900
In this case _route returns the currently active route:
_route
https://github.com/emberjs/ember.js/blob/2cc35738f2938e6b9735d0d641214b0721d53a4b/packages/%40ember/-internals/glimmer/lib/components/link-to.ts#L490-L493
This then breaks the href computed property in L791, if the router performs an intermediate transition to an error route:
href
error
https://github.com/emberjs/ember.js/blob/2cc35738f2938e6b9735d0d641214b0721d53a4b/packages/%40ember/-internals/glimmer/lib/components/link-to.ts#L749-L804
routing.generateURL(route, models, query) is called as:
routing.generateURL(route, models, query)
routing.generateURL("blog.post.error", [], { lang: "Japanese" });
Which misses the error param:
Error: You must provide param `error` to `generate`.
This apparently used to work and while being a weird edge-case, I would still expect it to work.
Thank you for reporting!
Just to confirm, this is a bug in 3.10.0-beta series right?
Correct! AFAICT it's working in 3.9.
Awesome! 🎉
While working on https://github.com/ember-engines/ember-engines/pull/642 to make ember-engines compatible with Ember Octane, I noticed that https://github.com/emberjs/ember.js/pull/17772 appears to have broken an edge case for
<LinkTo>
without a@route
argument, but with a@query
argument.I made a reproduction here: https://codesandbox.io/s/p32ozvvz0x
If no explicit
@route
is passed it will be set to (or remain)UNDEFINED
:https://github.com/emberjs/ember.js/blob/2cc35738f2938e6b9735d0d641214b0721d53a4b/packages/%40ember/-internals/glimmer/lib/components/link-to.ts#L895-L900
In this case
_route
returns the currently active route:https://github.com/emberjs/ember.js/blob/2cc35738f2938e6b9735d0d641214b0721d53a4b/packages/%40ember/-internals/glimmer/lib/components/link-to.ts#L490-L493
This then breaks the
href
computed property in L791, if the router performs an intermediate transition to anerror
route:https://github.com/emberjs/ember.js/blob/2cc35738f2938e6b9735d0d641214b0721d53a4b/packages/%40ember/-internals/glimmer/lib/components/link-to.ts#L749-L804
routing.generateURL(route, models, query)
is called as:Which misses the
error
param:This apparently used to work and while being a weird edge-case, I would still expect it to work.