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

Document queryParamsDidChange #10877

Closed
danfinlay opened this issue Apr 14, 2015 · 13 comments
Closed

Document queryParamsDidChange #10877

danfinlay opened this issue Apr 14, 2015 · 13 comments

Comments

@danfinlay
Copy link

Right now Ember.Route has an action queryParamsDidChange that is triggered when query params change.

This is useful when needing to override the usual query-param-changing behavior.

However, this method is not in the ember docs, I had to find mention of it in a discussion online.

@hparra
Copy link

hparra commented Apr 16, 2015

👍 Search to find in source turned this issue up.

See

queryParamsDidChange(changed, totalPresent, removed) {

@Gaurav0
Copy link
Contributor

Gaurav0 commented Apr 14, 2016

@rwjblue @stefanpenner Is this method intended to be public or private?

@rwjblue
Copy link
Member

rwjblue commented Apr 14, 2016

@Gaurav0 - I am unsure, we likely need to ask @machty....

@elidupuis
Copy link

FWIW, I'd like it to be public :D

@stefanpenner
Copy link
Member

i suspect public, but @machty may be able to shed light. Will rope him in.

@machty
Copy link
Contributor

machty commented Apr 21, 2016

I don't think I ever intended queryParamsDidChange to be public. It was needed as part of the somewhat convoluted contract with using router.js as a microlib, but it ended up serving as an escape hatch for folk who had unusual serialization/default needs while we figured out the correct APIs to build into Ember. I'd vote to keep it private, but we should start collecting feedback as to how people are using queryParamsDidChange for the next iteration of query params (probably as part of a routing service).

@elidupuis
Copy link

👍 to QP support in a routing service.

Currently, I'm basically using my own service to keep track of QPs. When they get set by user action I can easily intercept and update my service directly—at the same time as setting the controller properties that are bound to the URL. However, queryParamsDidChange is proving to be very useful on page load as it allows me to get my service up-to-date immediately. I tried doing this on controller.init instead but the QPs all still have their default value instead of what's in the URL.

I suppose all of this is moot if there was a standard routing service that held all this info.

@rwjblue
Copy link
Member

rwjblue commented Apr 22, 2016

@knownasilya's service addon is pretty nice for this: https://github.com/knownasilya/ember-query-params. It is good to feel out the space of using a service for this, so we can learn the best patterns and try to incorporate them upstream...

@elidupuis
Copy link

Cool. I'll take a look.

@knownasilya
Copy link
Contributor

but we should start collecting feedback as to how people are using queryParamsDidChange for the next iteration of query params (probably as part of a routing service).

@machty I'm currently using that action for that exact purpose, see the link that @rwjblue posted above.

@knownasilya
Copy link
Contributor

This can be closed, #13398 was merged.

@michaelklopf
Copy link

What is the current state for queryParamsDidChange? Docs were added for the feature, but it's still private and possible to vanish at some point?

@knownasilya
Copy link
Contributor

knownasilya commented Jun 13, 2018

I think it's called intimate API, meaning people are using it, so most likely there would be a deprecation if it was to go away before they removed it. So you'd at least have some warning if using it.

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