refactor(api): code-review fixes (R7 S3b review round 1)
- barrel re-exports domains with `export type *` (not `export *`) so the internal downloadsApi/plexApi/messagingApi slices stay behind the façade; plex's runtime value exports (EMPTY_PLEX_FILTERS/plexFilterCount) re-exported explicitly - App.tsx: drop the now-redundant `prefs as Record<string, unknown>` self-cast (Me.preferences is already that type) and its `prefsRec` alias - plex.ts: comment why plexSetState keeps its status union inline (reusing VideoStatus would make an api.ts↔plex.ts type cycle) Behaviour-identical. Gate green: typecheck, eslint 0, prettier, 74 vitest.
This commit is contained in:
@@ -228,9 +228,8 @@ export default function App() {
|
||||
useEffect(() => {
|
||||
const prefs = meQuery.data?.preferences;
|
||||
if (!prefs) return;
|
||||
const prefsRec = prefs as Record<string, unknown>;
|
||||
(["feed", "plex", "playlists"] as PanelId[]).forEach((p) => {
|
||||
const raw = prefsRec[PREF_KEY[p]];
|
||||
const raw = prefs[PREF_KEY[p]];
|
||||
if (raw) {
|
||||
const l = normalizeLayout(p, raw);
|
||||
setPanelLayouts((prev) => ({ ...prev, [p]: l }));
|
||||
@@ -245,9 +244,9 @@ export default function App() {
|
||||
setFilterCollapsedState(prefs.filterCollapsed);
|
||||
writeAccount(LS.filterCollapsed, prefs.filterCollapsed);
|
||||
}
|
||||
if (typeof prefsRec.playlistsCollapsed === "boolean") {
|
||||
setPlaylistsCollapsedState(prefsRec.playlistsCollapsed);
|
||||
writeAccount(LS.playlistsCollapsed, prefsRec.playlistsCollapsed);
|
||||
if (typeof prefs.playlistsCollapsed === "boolean") {
|
||||
setPlaylistsCollapsedState(prefs.playlistsCollapsed);
|
||||
writeAccount(LS.playlistsCollapsed, prefs.playlistsCollapsed);
|
||||
}
|
||||
const lang = prefs.language;
|
||||
if (typeof lang === "string" && isSupported(lang)) setLanguage(lang);
|
||||
|
||||
Reference in New Issue
Block a user