adhit-r / adhit-r/holocron

Persist search type-filter chips to localStorage

Aperta
#25 2 commenti 0 reazioni 1 assegnatario Rivendicata da @anhoee Vedi su GitHub
area: ux good first issue help wanted
Lingua principale
TypeScript
Stelle
0
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

> **Skills:** TypeScript · React · localStorage
> **Time:** ~30 minutes
> **Good for:** Quick win · first-PR
> **Difficulty:** Beginner-friendly

---

## Context

The search palette's type-filter chips (`People · Planets · Ships · …`) reset on close. Power users who consistently filter by, say, "people only" have to re-toggle every time they open search.

## Goal

Persist `typeFilter` to `localStorage` with key `holocron:search_filter`. Restore on palette open. Clear on click of the existing "Clear" button.

## Where to start

- `components/explorer/SearchPalette.tsx`
- `typeFilter` state initializer reads from `localStorage` (with a try/catch for SSR / disabled-storage)
- A `useEffect([typeFilter])` writes back

## Acceptance criteria

- Filter survives palette close/reopen
- Filter survives full page reload
- Filter cleared on "Clear" button + on `localStorage` clear
- Doesn't break SSR (storage access is client-only)
- `npx tsc --noEmit` exits 0

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.