refactor(channels): share useSortState across the manager + discovery (R13 S1)
ChannelsProvider and ChannelDiscovery each hand-rolled the same sort plumbing (useState<SortState> + parseSortState + a persist key). Both now use the shared useSortState hook. hydrateSort gains an empty-options rule: with no vocabulary passed it parses without healing (these owners heal for display via ColumnSortControl against the live columns), so the un-healed provider store is preserved. plexSortKeys made module-private (knip). Closes R13 S1: feed, Plex, and the two channel tables all sort through one SortControl + one SortState model. Gate green: tsc/eslint(0 err)/prettier/knip clean, vitest 94.
This commit is contained in:
@@ -7,7 +7,7 @@ import { hydrateSort, type SortOption, type SortState } from "./columnSort";
|
||||
// key). One home so a new sortable surface (Plex, a future table) gets persistence for free.
|
||||
export function useSortState(
|
||||
storageBase: string,
|
||||
options: SortOption[],
|
||||
options: SortOption[] = [],
|
||||
fallback: SortState = null,
|
||||
): [SortState, (next: SortState) => void] {
|
||||
const [sort, setSort] = useState<SortState>(() =>
|
||||
|
||||
Reference in New Issue
Block a user