fix: stop plex settings hanging when tautulli fails to load

The loading guard required dataTautulli but only checked the Plex error, so a failed Tautulli
request would leave the spinner up indefinitely in both setup and normal settings. Setup hides the
Tautulli section entirely, so the request is skipped there rather than awaited.
This commit is contained in:
fallenbagel
2026-07-31 07:03:28 +08:00
parent a095b9f330
commit f5696968e7

View File

@@ -125,8 +125,13 @@ const SettingsPlex = ({ isSetupSettings }: SettingsPlexProps) => {
error,
mutate: revalidate,
} = useSWR<PlexSettings>('/api/v1/settings/plex');
const { data: dataTautulli, mutate: revalidateTautulli } =
useSWR<TautulliSettings>('/api/v1/settings/tautulli');
const {
data: dataTautulli,
error: errorTautulli,
mutate: revalidateTautulli,
} = useSWR<TautulliSettings>(
isSetupSettings ? null : '/api/v1/settings/tautulli'
);
const { data: dataSync, mutate: revalidateSync } = useSWR<SyncStatus>(
'/api/v1/settings/plex/sync',
{
@@ -334,7 +339,11 @@ const SettingsPlex = ({ isSetupSettings }: SettingsPlexProps) => {
}
};
if ((!data || !dataTautulli) && !error) {
if (
(!data || (!isSetupSettings && !dataTautulli)) &&
!error &&
!errorTautulli
) {
return <LoadingSpinner />;
}
return (