feat: render active filters as inline chips in search where input#2388
feat: render active filters as inline chips in search where input#2388MikeShi42 wants to merge 3 commits into
Conversation
Replaces the separate ActiveFilterPills row below the search input with inline filter chips rendered directly inside SearchWhereInput. The chips slot is wired through both SQLInlineEditor (CodeMirror) and AutocompleteInput (Lucene), and Backspace at cursor position 0 removes the last chip. - Add InlineFilterChips component and filterPillUtils helpers - Add filterChips + onRemoveLastChip props to SQLInlineEditor, AutocompleteInput, and SearchInputV2 - Wire SearchWhereInput to flatten searchFilters into chips and handle last-chip removal - Remove ActiveFilterPills component and its test - Add unit tests for InlineFilterChips and filterPillUtils, plus an E2E suite (filter-chips.spec.ts)
🦋 Changeset detectedLatest commit: 95fa195 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
E2E Test Results✅ All tests passed • 218 passed • 3 skipped • 1331s
Tests ran across 4 shards in parallel. |
Deep Review🟡 P2 — recommended
🔵 P3 nitpicks (3)
Reviewers (10): correctness, testing, maintainability, project-standards, agent-native, learnings-researcher, kieran-typescript, julik-frontend-races, api-contract, adversarial. Testing gaps:
|
- SCSS: collapse `:not(.expanded):not([data-has-chips])` into a single complex `:not(.expanded, [data-has-chips])` to satisfy stylelint's `selector-not-notation` rule. - Unit: remove the `@/components/ActiveFilterPills` jest.mock from DBSearchPage.directTrace.test.tsx since the component was deleted. - E2E: the sidebar writes filters in Lucene form (`field:"value"`), not SQL `'value'`, so the URL-sync wait check in `applySidebarFilter` never matched. Switch to a value-substring check and bump the timeout to 10s for slower CI environments.
|
@MikeShi42 can you take a look at this PR? #2360 or HDX-4381 Previously, when a user switched the active source on the search page (e.g. Logs → Traces), any filters with fields not present in the new source were silently dropped. A transient yellow toast notified the user, but their selection and the context for switching back was lost. The idea of the PR ##2360 was to keep those filters visible in the ActiveFilterPills bar using a muted, strikethrough, dashed-border style, along with a tooltip explaining why they aren’t applied. The filters are excluded from the generated query to keep it valid, and they automatically reapply if the user switches back to a compatible source. Would be possible to achieve something similar in this PR? Do you think that proposal makes sense? |
Summary
Replaces the separate
ActiveFilterPillsrow below the search input with inline filter chips rendered directly insideSearchWhereInput. The chips slot is wired through bothSQLInlineEditor(CodeMirror) andAutocompleteInput(Lucene), and Backspace at cursor position 0 removes the last chip — making filter state feel native to the input rather than parked beside it.What changed
InlineFilterChipscomponent +filterPillUtilshelpers (flattenFilters,removePill) that turn aFilterStateinto a list of chips and route removal back through the existing filter-state hook.SQLInlineEditor,AutocompleteInput, andSearchInputV2all gain optionalfilterChipsandonRemoveLastChipprops.SearchWhereInputaccepts a newsearchFilters?: FilterStateHookprop, flattens it into chips, and forwards both the chip nodes and the last-chip removal callback to whichever underlying editor is active.ActiveFilterPills(and its test) — its responsibility is now subsumed bySearchWhereInput.DBSearchPagedrops the<ActiveFilterPills .../>row and passes itssearchFiltershook toSearchWhereInputinstead.Tests
InlineFilterChips.test.tsx(rendering, group container, no artificial limit),filterPillUtils.test.ts(flatten + remove semantics).tests/e2e/features/search/filter-chips.spec.ts+ aFilterChipsComponentpage object.Test plan
/search, apply a couple of sidebar filters (e.g.ServiceName,SeverityText) — verify chips appear inside the where input, not below it.Notes
main(8e52cef). Conflict resolution preserved main'sword-break: break-allfix (fix: use character-level word breaking in Lucene search input #2181) and thee.preventDefault()additions on ArrowDown/ArrowUp from the autocomplete refactor (feat: fast and full autocomplete #2128).ActiveFilterPillsis dropped because the component is removed — let me know if any of that styling should be carried over toInlineFilterChips.