mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 05:05:38 -04:00
Replace ad-hoc useState/useEffect fetch patterns with Jotai atoms and loadables in StatsDisplay, FilterableTitleRow, BackupScheduleSection, IntegrationsSection, and CommandPalette. Each component now gets a scoped Jotai Provider with a pre-initialized store so server-rendered initial values hydrate correctly. Async data fetching moves into atom-level loadables, eliminating manual loading flags and cancellation logic throughout.
10 lines
318 B
TypeScript
10 lines
318 B
TypeScript
import { atom } from "jotai";
|
|
import { atomWithStorage } from "jotai/utils";
|
|
|
|
export const commandPaletteOpenAtom = atom(false);
|
|
export const helpOpenAtom = atom(false);
|
|
|
|
const RECENT_KEY = "cp:recent-searches";
|
|
export const MAX_RECENT = 5;
|
|
export const recentSearchesAtom = atomWithStorage<string[]>(RECENT_KEY, []);
|