Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Search: restore snippets to filters sidebar#63587

Merged
camdencheek merged 17 commits intomainfrom
cc/sidebar-snippets
Jul 8, 2024
Merged

Search: restore snippets to filters sidebar#63587
camdencheek merged 17 commits intomainfrom
cc/sidebar-snippets

Conversation

@camdencheek
Copy link
Member

@camdencheek camdencheek commented Jul 1, 2024

This adds snippets back to the search sidebar, which got missed when it was redesigned.

This includes some refactoring of the Svelte version to account for filter types that do not match 1:1 with the backend types. We initially tried to tie them tightly with the backend types so the backend is the source of truth, but I think we want to have the ability to introduce client-side-only filters, which we already sorta hackily do with the type: filters. And it's even more hacky with the count: filter in the React webapp (which doesn't look like it was ever implemented in the Svelte version).

In the React app, I made the minimum changes to get this working (no associated refactoring).

Fixes SRCH-580

Test plan

Added a couple of simple playwright tests. Manually tested that:

  • Snippets in settings show up in the sidebar
  • Clicking them filters your results with that snippet
  • Clicking them again unfilters your results
  • Moving to query works
  • The correct telemetry events are generated

Changelog

  • Restores search snippets in the search sidebar

@cla-bot cla-bot bot added the cla-signed label Jul 1, 2024
@camdencheek camdencheek force-pushed the cc/sidebar-snippets branch from b08058c to 4ce4f7c Compare July 2, 2024 15:05
@camdencheek camdencheek changed the title Cc/sidebar snippets Search: restore snippets to filters sidebar Jul 2, 2024
@camdencheek camdencheek marked this pull request as ready for review July 2, 2024 16:24
@camdencheek camdencheek requested a review from a team July 2, 2024 16:25
$: groupedSelectedFilters = Object.groupBy(selectedFilters, ({ kind }) => kind)

let groupedStreamFilters: Partial<Record<SectionKind, StreamFilter[]>>
$: groupedStreamFilters = Object.groupBy(streamFilters, ({ kind }) => kind)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.groupBy is relatively new. Not sure about our browser compatibility strategy though.

@camdencheek camdencheek merged commit 3a76ec8 into main Jul 8, 2024
@camdencheek camdencheek deleted the cc/sidebar-snippets branch July 8, 2024 16:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants