Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set 'error' route on 2.10 #14650

Closed
diamondo25 opened this issue Nov 29, 2016 · 29 comments
Closed

Unable to set 'error' route on 2.10 #14650

diamondo25 opened this issue Nov 29, 2016 · 29 comments

Comments

@diamondo25
Copy link

diamondo25 commented Nov 29, 2016

Ember.js is setting the 'error' route by default, but route-recognizer does not allow duplicate routes anymore:
https://github.com/tildeio/route-recognizer/blame/5d54688f04273d3a921470b903a36266dddcdaf2/dist/route-recognizer.js#L525-L531

Doing so will give you a blank page with an error in your console:

Uncaught Error: You may not add a duplicate route named `error`

Default 'error' routes are set here:

createRoute(dsl, 'loading');
createRoute(dsl, 'error', { path: dummyErrorRoute });

You can test it by trying to handle error route using ember g route error.
This functionality worked fine in 2.9 .

@locks
Copy link
Contributor

locks commented Nov 29, 2016

@diamondo25 Can you reproduce in a Twiddle please?

@diamondo25
Copy link
Author

@Dhaulagiri
Copy link
Contributor

I'm seeing this as well and I don't recall seeing it in the most recent beta from yesterday

@nathanhammond
Copy link
Member

nathanhammond commented Nov 29, 2016

Seems legit. This is by virtue of a route-recognizer change I made. Need to lock out the default creation if the user has already created one. (I know how to fix, will get to it.)

@nathanhammond
Copy link
Member

Crosslinking: tildeio/route-recognizer#118

@pixelhandler
Copy link
Contributor

@nathanhammond thanks for fixing so quickly! @rwjblue I labeled as "Bug" perhaps this issue can be resolved with an upcoming 2.10.1 release.

@nathanhammond
Copy link
Member

nathanhammond commented Dec 3, 2016

That's not the fix, @pixelhandler! That's where the bug was introduced. 😜This does need a point release once fixed, but I have a few other things to address before I can get back to do the router things. (I've got about 5 open issues to address.)

@tosidsethi
Copy link

Is there a status on this guy?

@ZeeJab
Copy link

ZeeJab commented Dec 27, 2016

We hit this issue upgrading the Bustle app to 2.10, and we'll need to either refactor our root error route to be named differently or hold off upgrading to 2.10.

@supersabillon
Copy link

We are also interested in the status of this bug. We are holding off from upgrading to 2.10 for the time being.

@justinaray
Copy link

justinaray commented Jan 26, 2017

I was hoping I could work around this by not explicitly registering the error route and leaving my error template, route, etc. in place. I tried it and found:

  • On a failed route hook, the router will bubble up to the error route and my custom template is shown.
  • On a deliberate transition to error, the router does not transition to my template. Interestingly though, it does not log the same error message you get when a route doesn't exist.

I am thinking maybe I could leave the template, route, controller, etc. in place and register a custom error route pointing to the same template for my explicitly handled error cases. Maybe this would handle both the caught and uncaught errors with my custom template.

@nathanhammond - Do you have any thoughts on the above? Worth the hackery or better to just wait on an official fix?

@justinaray
Copy link

Nevermind :(

The above proposal would still require the error mapping and would trigger this bug.

I may just go with making the custom route for my handled errors and using my same error component in the error template.

Seems to be the only other approach pending a fix.

CC: @nathanhammond

@Glennvd
Copy link

Glennvd commented Jan 31, 2017

I've noticed that this is fixed in ember v2.12.0-beta.1, is there any chance to get this fix backported to a 2.11 release? Since the 2.12 beta introduces a whole bunch of new issues.

@rwjblue
Copy link
Member

rwjblue commented Jan 31, 2017

Since the 2.12 beta introduces a whole bunch of new issues.

Please report any issues you find with the beta cycle!

Is there any chance to get this fix backported to a 2.11 release?

Yes, I think that is a good idea.

@justinaray
Copy link

It looks like this has been commented out in v0.2.9+ with 27c0f57 and 9b21d93 for the 0.3.x series.

@rwjblue would this just get patched back to 2.11 or 2.10 also? I am not sure of the process for deciding which bugs get patched in which version.

@rwjblue
Copy link
Member

rwjblue commented Feb 16, 2017

Fixed in 2.11.1

@rwjblue rwjblue closed this as completed Feb 16, 2017
@Glennvd
Copy link

Glennvd commented Feb 17, 2017

Was this fixed in a different way than beta.1? Just tried out 2.11.1 and that still gives me a duplicate route error about "hotel.error" while the beta doesn't.

@rwjblue rwjblue reopened this Feb 17, 2017
@rwjblue
Copy link
Member

rwjblue commented Feb 17, 2017

@Glennvd - Yes they are different versions of route-recognizer (0.2.9 for 2.11 and 0.3 for 2.12). It is possible that I mucked this up somehow. Can you share the error and stack trace you get with 2.11? Also, possible a twiddle and/or demo repo? I'm happy to release a 2.11.2 once we figure out what I did wrong..

@Glennvd
Copy link

Glennvd commented Feb 17, 2017

@rwjblue I've got a twiddle here, just needs to be changed to the right ember version https://ember-twiddle.com/e4b8412bf5629483f94276a001598571

Full stacktrace (from my own app) below.

(anonymous) (ember.debug.js:57247)
(anonymous) (ember.debug.js:55191)
eachRoute (ember.debug.js:55179)
eachRoute (ember.debug.js:55177)
eachRoute (ember.debug.js:55177)
map (ember.debug.js:55190)
map (ember.debug.js:57244)
_initRouterJs (ember.debug.js:27511)
setupRouter (ember.debug.js:27606)
startRouting (ember.debug.js:27592)
startRouting (ember.debug.js:2887)
didBecomeReady (ember.debug.js:3867)
invoke (ember.debug.js:337)
flush (ember.debug.js:405)
flush (ember.debug.js:529)
end (ember.debug.js:599)
run (ember.debug.js:722)
join (ember.debug.js:744)
run.join (ember.debug.js:22286)
(anonymous) (ember.debug.js:22349)
mightThrow (jquery.js:3570)
process (jquery.js:3638)
nrWrapper ((index):97)

Error is still the same Uncaught Error: You may not add a duplicate route named hotel.error.

@gmaliar
Copy link

gmaliar commented Feb 17, 2017

@rwjblue running

grep --recursive "RouteRecognizer.VERSION" node_modules/ember-source

returns

node_modules/ember-source/dist/ember.debug.js:RouteRecognizer.VERSION = '0.2.8';
node_modules/ember-source/dist/ember.js:RouteRecognizer.VERSION = '0.2.8';
node_modules/ember-source/dist/ember.prod.js:RouteRecognizer.VERSION = '0.2.8';

@rwjblue
Copy link
Member

rwjblue commented Feb 17, 2017

Yeah, the issue is that route-recognizer@0.2.9 was released with 0.2.8's dist output. I'm working on it...

@gmaliar
Copy link

gmaliar commented Feb 17, 2017

@rwjblue, Much appreciated sir.
Let me know if you need anything!

@rwjblue
Copy link
Member

rwjblue commented Feb 17, 2017

OK, I released route-recognizer@0.2.10 with the updated dist output, then bumped in the release branch (in 6c7e695), and confirmed in the build output (in components/ember@4a9c736).

I then confirmed with the twiddle shared by @Glennvd above that when using release branch no assertion happens (and the app boots).

If someone else can sanity check me here, I can release 2.11.2...

@gmaliar
Copy link

gmaliar commented Feb 17, 2017

On it.

@gmaliar
Copy link

gmaliar commented Feb 17, 2017

@rwjblue forgive my noobiness,
I'm trying to build my project with

devDependencies: {
// ...
"ember-source": "git://github.com/emberjs/ember.js.git#6c7e6950f127aa31912b5729971703c0c9615655"
// ...

but it fails on

$ ember build
⠋ Building
Cannot find module 'node_modules/ember-source/dist/ember-template-compiler.js'

What am I doing wrong :)?

@locks
Copy link
Contributor

locks commented Feb 17, 2017

@gmaliar ember-source doesn't have the build artifacts in the repository, so you need to use the bower tag, or clone, build, and link ember locally.

@gmaliar
Copy link

gmaliar commented Feb 18, 2017

Thanks @locks,
@rwjblue I can confirm it is working.

@btecu
Copy link
Contributor

btecu commented Mar 1, 2017

This can be closed, it works properly on 2.11.2.

@locks
Copy link
Contributor

locks commented Mar 7, 2017

Thanks for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests