From 52c1162f3ce3545f9cfc35f4bab6b61423f9dd67 Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Thu, 23 Oct 2025 12:01:06 -0600 Subject: [PATCH] fix new settings with incorrect data homeSectionOrder should never be empty. --- src/backend/accounts/settings.ts | 20 ++++++++++---------- src/hooks/auth/useAuthData.ts | 12 +++++++----- src/stores/preferences/index.tsx | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/backend/accounts/settings.ts b/src/backend/accounts/settings.ts index 50700700..1460aa9c 100644 --- a/src/backend/accounts/settings.ts +++ b/src/backend/accounts/settings.ts @@ -19,17 +19,17 @@ export interface SettingsInput { enableImageLogos?: boolean; enableCarouselView?: boolean; forceCompactEpisodeView?: boolean; - sourceOrder?: string[]; + sourceOrder?: string[] | null; enableSourceOrder?: boolean; - disabledSources?: string[]; - embedOrder?: string[]; + disabledSources?: string[] | null; + embedOrder?: string[] | null; enableEmbedOrder?: boolean; - disabledEmbeds?: string[]; + disabledEmbeds?: string[] | null; proxyTmdb?: boolean; enableLowPerformanceMode?: boolean; enableNativeSubtitles?: boolean; enableHoldToBoost?: boolean; - homeSectionOrder?: string[]; + homeSectionOrder?: string[] | null; manualSourceSelection?: boolean; enableDoubleClickToSeek?: boolean; } @@ -50,17 +50,17 @@ export interface SettingsResponse { enableImageLogos?: boolean; enableCarouselView?: boolean; forceCompactEpisodeView?: boolean; - sourceOrder?: string[]; + sourceOrder?: string[] | null; enableSourceOrder?: boolean; - disabledSources?: string[]; - embedOrder?: string[]; + disabledSources?: string[] | null; + embedOrder?: string[] | null; enableEmbedOrder?: boolean; - disabledEmbeds?: string[]; + disabledEmbeds?: string[] | null; proxyTmdb?: boolean; enableLowPerformanceMode?: boolean; enableNativeSubtitles?: boolean; enableHoldToBoost?: boolean; - homeSectionOrder?: string[]; + homeSectionOrder?: string[] | null; manualSourceSelection?: boolean; enableDoubleClickToSeek?: boolean; } diff --git a/src/hooks/auth/useAuthData.ts b/src/hooks/auth/useAuthData.ts index ea573788..38339071 100644 --- a/src/hooks/auth/useAuthData.ts +++ b/src/hooks/auth/useAuthData.ts @@ -186,7 +186,7 @@ export function useAuthData() { } if (settings.sourceOrder !== undefined) { - setSourceOrder(settings.sourceOrder); + setSourceOrder(settings.sourceOrder ?? []); } if (settings.enableSourceOrder !== undefined) { @@ -194,11 +194,11 @@ export function useAuthData() { } if (settings.disabledSources !== undefined) { - setDisabledSources(settings.disabledSources); + setDisabledSources(settings.disabledSources ?? []); } if (settings.embedOrder !== undefined) { - setEmbedOrder(settings.embedOrder); + setEmbedOrder(settings.embedOrder ?? []); } if (settings.enableEmbedOrder !== undefined) { @@ -206,7 +206,7 @@ export function useAuthData() { } if (settings.disabledEmbeds !== undefined) { - setDisabledEmbeds(settings.disabledEmbeds); + setDisabledEmbeds(settings.disabledEmbeds ?? []); } if (settings.proxyTmdb !== undefined) { @@ -234,7 +234,9 @@ export function useAuthData() { } if (settings.homeSectionOrder !== undefined) { - setHomeSectionOrder(settings.homeSectionOrder); + setHomeSectionOrder( + settings.homeSectionOrder ?? ["watching", "bookmarks"], + ); } if (settings.manualSourceSelection !== undefined) { diff --git a/src/stores/preferences/index.tsx b/src/stores/preferences/index.tsx index 203577ca..1d8a4207 100644 --- a/src/stores/preferences/index.tsx +++ b/src/stores/preferences/index.tsx @@ -188,7 +188,7 @@ export const usePreferencesStore = create( }, setHomeSectionOrder(v) { set((s) => { - s.homeSectionOrder = v; + s.homeSectionOrder = v.length > 0 ? v : ["watching", "bookmarks"]; }); }, setManualSourceSelection(v) {