You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 467c167
Browse filesBrowse the repository at this point in the historyBrowse files
## Summary
Closes#3227
We pin a few fields on our main logs source, and every time we open search they all come back expanded, so we collapse them again each time. This keeps a pinned field collapsed across reloads.
- New `useCollapsedPinnedFields(sourceId)` hook in `searchFilters.tsx`: per-source list of collapsed pinned fields in localStorage (`hdx-collapsed-pinned-fields`), personal like the other sidebar expand states (`hdx-filters-expanded`, `hdx-shared-filters-expanded`).
- In the filters sidebar, a pinned field (personal or shared) that the user collapses stays collapsed on the next load. It still opens when it has an active filter, so a selection is never hidden. Expanding it again removes it from the list.
- Nested map groups (`LogAttributes.*`, ...) are unchanged: they keep their own expand logic. Happy to follow up if wanted.
### Screenshots or video
Pinned `SeverityText`, collapsed, then page reloaded (`yarn app:dev:local`, demo ClickHouse, `otel.otel_logs`).
| Before | After |
| :----- | :---- |
|  |  |
### How to reproduce
**Starting point:** `yarn app:dev:local` connected to the demo server, Logs source on `/search`.
**On `main`:**
1. In the Filters sidebar, pin the `SeverityText` field (pin icon on its row).
2. Collapse `SeverityText`.
3. Reload the page: `SeverityText` is expanded again.
**On this branch:**
1. Same steps: after the reload `SeverityText` stays collapsed.
2. Select a value in it, reload: it opens (active filter).
3. Expand it again, reload: it stays expanded.
### How to test on Vercel preview
**Preview routes:** /search
**Steps:**
1. Open /search on the Logs source.
2. In the Filters sidebar, click the pin icon on the `SeverityText` field.
3. Click the `SeverityText` header to collapse it.
4. Reload the page.
5. Verify the `SeverityText` filter group is collapsed.
### References
- Issue: #3227
- Tests: `packages/app/src/__tests__/pinnedFilters.test.ts` (state survives a remount, cleared on expand, kept per source, nothing stored without a source)
- Related PRs:
0 commit comments