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

Suggestion: Throw error if user calls UIRouterReact.start() twice #65

Closed
telekid opened this issue Aug 1, 2017 · 1 comment
Closed

Comments

@telekid
Copy link

telekid commented Aug 1, 2017

I burned a few hours attempting to fix an issue that was actually a side-effect of unintentionally calling start() on my router object twice – once in my router.config file (inspired by the sample app,) and then once again by passing router to the UIRouter component.

The trouble is, it isn't particularly obvious that passing a UIRouterReact class to a UIRouter component (<UIRouter router={router}></UIRouter>) automatically calls the start() method on router.

Since I can't actually think of any reason why a user would choose to call router.start() twice in the same application, it may be prudent to throw an error if a user attempts to do so.

@elboman
Copy link
Member

elboman commented Aug 4, 2017

Yeah, we should definitely warn the user if the start method is called more than once.

The thing is, since the UIRouter component takes care of start()ing the router whether you pass it an instance or let it create the instance for you, I don't think you ever need to do it yourself.

We should definitely update the sample app (as it's using the old version/syntax) as well as migration guide from the 0.4.x

Thanks for the heads up!

@elboman elboman closed this as completed in d48c9fb Dec 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants