question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setDefaultQueryParamValue - not working as expected?

See original GitHub issue

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 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:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aaronfischercommented, May 31, 2017

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!

0reactions
allthesignalscommented, Apr 28, 2018

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.

This is interesting and could be a way to approach my issue in #54. Curious if you have an example for it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set default query string parameter value for webapi?
The name parameter needs to have a default value, if I use string name = "world", it seems not working and throw
Read more >
Query param not behaving as expected - Stack Overflow
I'm using an :order query param to pass an order argument to my function. Unfortunately, it seems not to have an effect on...
Read more >
TypeCompiler default Values not set · Issue #203 - GitHub
I'm using this Type.Object for my search requests, before with ajvPlugin automatically was setting up default values and we're not required ...
Read more >
Query Parameters - Redash
This is useful for debugging if your dashboard does not return expected results. Default Value is what Redash will use if no other...
Read more >
Manipulating SSRS parameter functionality - West Monroe
Set the default value of each equal to its respective parameter count (ex: ... As you'd expect, simply passing the @Team values to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found