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

Ignore parameters that are not used by any state #100

Open
TehShrike opened this issue Mar 21, 2017 · 3 comments
Open

Ignore parameters that are not used by any state #100

TehShrike opened this issue Mar 21, 2017 · 3 comments

Comments

@TehShrike
Copy link
Owner

TehShrike commented Mar 21, 2017

This is one of my diversions from ui-router behavior that I regret.

Right now, you can pass whatever parameters into stateRouter.go or stateRouter.makePath and they will get put into the url and show up on the parameters object, even if no state depends on them.

I think that if you attempt to create a route, or if you try to navigate to a route, and you use any parameters that are not used by any of the states at the route you're going to, then those parameters should just be dropped and shouldn't show up in the url.

This could be accomplished with only a feature bump if a new option was added to stateRouter initialization, something like allowParametersNotUsedByAnyState or whatever. It could default to true (the current behavior).

Eventually, we could log a deprecation warning when that value was true, and eventually eventually we could flip the default to false.

Any thoughts?

@daytonlowell
Copy link
Contributor

daytonlowell commented Mar 21, 2017

The existing behavior does have the side effect of your state's state being maintained if the user navigates away from it and back. 🤷🏼‍♂️

@daytonlowell
Copy link
Contributor

daytonlowell commented Mar 21, 2017

But that's the only thing I could see someone currently relying on, as the parameters aren't actually passed into activate/resolve if they're not defined in the state's parameter list.

@TehShrike
Copy link
Owner Author

A more backwards-compatible way to do this would also be to leave the unused parameters in the URL, but not pass the values to the resolve/activate functions.

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

2 participants