Repository navigation
feat(search-query-builder): Remove default values for number based filters - #129334
Closed
sentry-junior[bot] wants to merge 9 commits into
Closed
sentry-junior[bot] wants to merge 9 commits into
sentry-junior[bot] wants to merge 9 commits into
Conversation
…lters New numeric, duration, size, percentage and currency filters (including aggregates) now start with an empty value instead of a placeholder such as 100 or 10ms, so the search isn't filtered by a value the user didn't pick. The grammar accepts an empty value for number based filters, e.g. `span.duration:>`, and the frontend parser marks those filters as FILTER_MUST_HAVE_VALUE, which the builder already tolerates while the value menu is open. Dashboard global filters keep their example values. Co-Authored-By: Nicholas Deschenes <nicholas.deschenes@sentry.io>
Contributor
📊 Type Coverage Diff✅ no issues found |
Rework the change so the search grammars stay as they are. A new number-based filter now starts without a value, but its placeholder value only lives in the builder's draft query. It is never committed, so onChange, onSearch and the API never see it. Entering a value commits the filter as usual, and leaving the filter without a value removes it. This reverts the grammar, parser and dashboard changes from the previous commit. Co-Authored-By: Nicholas Deschenes <nicholas.deschenes@sentry.io>
… number filter Leaving a new number filter without a value now commits it with its example value instead of removing it. Co-Authored-By: Nicholas Deschenes <nicholas.deschenes@sentry.io>
…tton is pressed Pressing the remove button closes the empty filter's value editor first, and the click could miss the button. The filter was left behind without a value and got the placeholder value on blur. Co-Authored-By: Nicholas Deschenes <nicholas.deschenes@sentry.io>
…ng filter Pressing the clear button moved focus out of an empty number filter first, which committed its placeholder value and ran a search before the query was cleared. Co-Authored-By: Nicholas Deschenes <nicholas.deschenes@sentry.io>
Contributor
Story previewsPreview the stories changed in this PR on the Vercel deployment: Preview deployment: https://sentry-54skx00tq.sentry.dev |
- Removing a pending filter on press no longer also removes the next filter, which reuses the remove button through positional item keys. - Changing a pending filter's operator to "is" no longer keeps its placeholder value as a selected value. - Rejecting an invalid value on blur marks the value editor closed, so the pending filter gets its placeholder value instead of staying empty. - Searching from the free text input uses the committed query while a filter is pending. Co-Authored-By: Nicholas Deschenes <nicholas.deschenes@sentry.io>
After an invalid value is rejected and the pending filter commits its placeholder, searching from the input uses the value the filter shows. Co-Authored-By: Nicholas Deschenes <nicholas.deschenes@sentry.io>
… changes Changing the key of a number filter without a value to another key of the same type committed the query and closed the key editor without returning focus to the filter. Committing removed the pending filter from the query and could leave a dangling Boolean operator (`OR device:foo`), and the focus loss then committed the placeholder value. While the filter is pending, the key change no longer commits the query and returns focus to the value editor, like an operator change does. Co-Authored-By: Nicholas Deschenes <nicholas.deschenes@sentry.io>
…e key editor closes Selecting the same key, pressing Escape, or committing an empty key input closed the key editor of a number filter without a value and moved focus out of the filter, which committed its placeholder value. Every key editor close except blur now sends focus back to the pending filter's value through a new SET_FOCUS_OVERRIDE action, which also replaces the focus override added to UPDATE_FILTER_KEY. Co-Authored-By: Nicholas Deschenes <nicholas.deschenes@sentry.io>
Contributor
|
Closing out as this is a bloated implementation now. Gonna go with #129535 instead. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
New number based filters (numeric, integer, currency, duration, size, percentage, and their aggregates) now start without a value, e.g.
span.duration:>, instead of being pre-filled with100,10ms,10bytes, etc. Previously the example value was committed into the query as soon as the filter was added, so results were filtered by a value the user never picked.No grammar or API changes. Neither the frontend nor the backend grammar can write an empty number filter (
key:>parses as an invalid text filter or free text in both). Instead of changing that, the builder keeps the incomplete filter out of the committed query:useQueryBuilderStatetracks apendingFilterKey. The draftquerystill holds the filter with its placeholder value, so the chip, operator menu and token-location logic work unchanged.committedQuerynever includes it.onChange,onSearchand the API only see the filter once a value is entered or the user leaves the filter. Pressing Enter in the free text input searches the committed query while a filter is pending.ORfrom removing the pending filter), and changing the key or operator returns focus to the value. Closing the key editor without a change (same key, Escape, or an empty key) also returns focus to the value; only blurring it counts as leaving the filter.span.duration:>10ms): Escape or Enter with an empty input, focus moving outside the filter, or blurring with an invalid value that gets rejected. Undo skips the pending state.Dashboard global filters call
getInitialFilterTextdirectly and are unchanged.Things to look at:
filter:N). After each action the reducer finds the filter again by the unchanged text before or after it. That covers the normal flows, but I'd like a second look at it.{Escape}to accept the default value still pass as onmaster. Specs that check the chip right after adding a filter now expect an empty value.via Nick.
--
View Session [Sentry]