-
Notifications
You must be signed in to change notification settings - Fork 40
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
setDefaultQueryParamValue - not working as expected? #23
Comments
@aaronfischer glad you're liking that addon!
This is actually intended behavior. Since we cant control whats in the URI, EDIT: I think this should be added to the documentation so others are not confused as well. |
@offirgolan Oh okay, thanks! So, if you don't mind, where would be the proper place to set the defaultValue to not have it appear in the URI? I was thinking that if |
@aaronfischer the URI default values are set by Ember on initial runtime. There currently is no way to change it no matter where you actually put the I guess one way to do this might be to make your API call in an initializer and create your QueryParam map from there and mix it in to the appropriate controller. |
Thanks @offirgolan . I ended up re-evaluating how I could make this work, long story short, its not a requirement for our API to receive those defaultValues (if the arrays match) so I was able to essentially just not set that specific query controller property if its expected value matched the defaultValues. A bit of additional management involved but it seems to work fine in our case. Looks like this is/was a non-issue of the add-on, thanks! |
This is interesting and could be a way to approach my issue in #54. Curious if you have an example for it? |
First off, I think I just stumbled upon a gem. 👍 LOVE the problems this addon is proposing to solve!
(Let me know if my expectations are off on this or not.)
I'm assuming that anywhere/anytime I set
setDefaultQueryParamValue
and those queryParams are in the URI they'll be removed (because they are now the default)? Currently that isn't the case though, looks to be the same way in the demo as well. You add "Jump" to thetags
and hit "Set as Defaults" but it remains in the URI.Is this the expected behavior?
Then, my own application, (perhaps you can tell me if this is the improper place to use
setDefaultQueryParamValue
):Within my route's
setupController
I make a request to the API and in that response I'm able to derive what my queryParams defaults will be so I firecontroller.setDefaultQueryParamValue('facetContext', record.mapBy('key'));
however like I previously noted the URI does not change and is still populated with the query param values (which should now be the defaults).Thanks!
EDIT: I've also tried moving my
setDefaultQueryParamValue
call into thebeforeModel
hook in case things need to be set before a model hook resolves.Just as a test if I was to statically set the
defaultValue: ['value1', 'value2'],
it will work as expected (omitting these values from the URL) but usingsetDefaultQueryParamValue
instead does not work.The text was updated successfully, but these errors were encountered: