Make sure queries have options and parameters #4952
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
Description
Bug
Queries without
parameters
in theiroptions
break Public Dashboards.Example: Dashboard/Public Dashboard
Cause
It's straightforward to understand that we rely on that Array for the Parameters functions to work. However, two questions intrigued me: "Why it fails only with Public Dashboards?" and "Why it started happening only now?"
So, the answers:
Previously what "guaranteed" that queries would have the parameters array before executing functions was this line:
redash/client/app/services/query.js
Line 240 in 3df1a86
On #4736 we removed the check for an existing query text that, specifically for Public Dashboards (don't have a query text), would also prevent parameters from being updated. Moving the line I mentioned a few lines above would also fix the problem, but I preferred to make sure queries had that from the constructor.
Related Tickets & Documents
--
Mobile & Desktop Screenshots/Recordings (if there are UI changes)
--