fix(ui): properly map over queryBuilder tags and set default values #16105
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.
Closes HoneyBadger #12
For the purposes of expediency and fixing a terrible prod bug, this bypasses good hygiene like tests. I added an issue to follow up on that.
Error was introduced here.
I initially noticed a lot of duplication of the initial state of tags, so I added the notion of an initial tag. Tags in query builder parlance map to the boxes at the bottom of the query builder. So each query that was built with the builder has an array of tags associated with it. On load, these tags are nulled out to an initial state. Here is a kinda psuedocode explanation of what that looks like:
When the query builder loads, it should loop over all the tag groups in the query builder and set them to default values.
What my buggy code did was this:
See the differences? It set the array of tags, which maps to each filtered section of a query, to an array with with a single item, the default tag.
big oof.
Testing Instructions:
On master:
Checkout this branch:
git checkout bs_fix_undefined_tags