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

Update QPs after url load #10

Closed
knownasilya opened this issue Apr 8, 2016 · 3 comments
Closed

Update QPs after url load #10

knownasilya opened this issue Apr 8, 2016 · 3 comments
Assignees

Comments

@knownasilya
Copy link
Owner

Currently defaults can be set, but if the url has values other then defaults on load, those are never set.
We can access a raw serialized queryParams in beforeModel or other hooks that have a transition.

We need a place to hook into to get the latest values, Or we can process the raw values using https://github.com/emberjs/ember.js/blob/57cf48cfce2acd895572f6f4c0b9478490259cdc/packages/ember-routing/lib/system/route.js#L380 and the types from the default values.

@knownasilya knownasilya changed the title Update QPs after route QPs Update QPs after url load Apr 8, 2016
@knownasilya
Copy link
Owner Author

Currently doing paramsRelay.setParams(this.paramsFor(this.routeName)) kind of helps, but you have to put it in the runloop and a run.later of 500. This prevents the finalizeQueryParams method from clobbering any observers using those values.

@knownasilya
Copy link
Owner Author

So the queryParamsDidChange is a good action (although undocumented and not public) to hook into to update the values on URL update. This makes the controller mixin almost redundent, since we can access the same data from the route and use the action limiting the API to one mixin. See the master branch for testing.

@knownasilya knownasilya self-assigned this Apr 11, 2016
@knownasilya
Copy link
Owner Author

Use the route mixin in 2.0

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

1 participant