setDefaultQueryParamValue - not working as expected?
See original GitHub issueFirst 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 the tags
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 fire controller.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 the beforeModel
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 using setDefaultQueryParamValue
instead does not work.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
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?