feat(explore): Add search filters to equation _if aggregates - #122912
feat(explore): Add search filters to equation _if aggregates#122912wmak wants to merge 12 commits into
Conversation
wmak
commented
Aug 27, 2026
- Adds conditional aggregates to the equation builder in explore
- Changes are behind the same feature flag as the conditionals on functions
Wire EAP conditional aggregates into the Explore equation builder with search-style filter autocomplete for the first argument (avg_if(`span.op:db`,span.duration)). Co-authored-by: Cursor <cursoragent@cursor.com>
Story previewsPreview the stories changed in this PR on the Vercel deployment: Preview deployment: https://sentry-kmayaxx8d.sentry.dev |
📊 Type Coverage Diff
🔍 9 new type safety issues introduced
Non-null assertions (
Type assertions (
This is informational only and does not block the PR. |
Flush pending argument edits when leaving the args grid, bound compound-filter clauses at boolean operators, and keep Discover-style avg_if/count_if editable when the EAP flag is on. Co-authored-by: Cursor <cursoragent@cursor.com>
…plete Master removed sentry/utils/useDebouncedValue; switch the new autocomplete hook to @tanstack/react-pacer. Co-authored-by: Cursor <cursoragent@cursor.com>
Clear emptied filters on blur, keep EAP-only _if definitions when args lack backticks, and place the caret after key select once React commits the value. Co-authored-by: Cursor <cursoragent@cursor.com>
narsaynorath
left a comment
There was a problem hiding this comment.
Still reviewing, but leaving two possibly larger comments here to think about before I get to the other files
Drop unused exports, cast combobox selection in tests, avoid stale value suggestions across keys, include boolean filter keys, and allow Enter to clear an _if filter. Co-authored-by: Cursor <cursoragent@cursor.com>
narsaynorath
left a comment
There was a problem hiding this comment.
My last comments on the first run-through of the PR 👍
The changes are a little complicated but I think due to the manual manipulation of the text fields, the editor code was always kind of tricky to make changes with since there are so many states.
One other thing I didn't comment on is that it seems like there isn't really support for key:[value1, value2] autocomplete. Maybe we can consider that as an improvement later on?
Another thing is, it did feel kind of cramped editing the filter in this case. I don't know if we'd want to consider expanding out the equation builder like we do when you select the conditional filter on an aggregation (introduced in your last PR) but I feel like the width just isn't enough to use comfortably
Function tokens are keyed by position, so deleting one reused the next function's draft arguments. Remount the arguments grid on token identity and extract filter/argument input into dedicated modules. Expand the equation builder while focused like the series filter bar. Co-authored-by: Cursor <cursoragent@cursor.com>
Clear skipBlurFlush on the next focus so later edits still commit, and only delete a function token when the caret is collapsed. Drop unused re-exports and align getFieldDefinition types. Co-authored-by: Cursor <cursoragent@cursor.com>
narsaynorath
left a comment
There was a problem hiding this comment.
Some final comments. I also wanted to suggest maybe it's possible to add another directory to colocate more of the conditional function argument code so the files have a clearer relationship. Stuff like useFunctionArgumentInput.tsx, conditionalFilterInput.tsx, etc
Keep filter suggestions working inside grouping parentheses, dismiss the expandable equation on Enter unless a suggestion is highlighted, colocate conditional-filter helpers, and align equation field height with the aggregate filter. Co-authored-by: Cursor <cursoragent@cursor.com>
…arens Preserve trailing grouping parentheses when replacing the next filter key, and let ComboBox commit on Enter before the expandable equation bar collapses. Co-authored-by: Cursor <cursoragent@cursor.com>
Restore selection after suggestion re-renders and wire native keyup so moving the caret into a filter key reliably shows key suggestions. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b621123. Configure here.
Keep spaces inside [a, b] in value mode so autocomplete does not split the list, and skip caret realignment when the filter input has a text range. Co-authored-by: Cursor <cursoragent@cursor.com>

