fix: folder loading gets error state + gcTime=0 for fresh refetch

Add a proper error branch to the folder tree so a failed sidecar request
shows an error state rather than a perpetual loading spinner. Also sets
gcTime: 0 so the query re-fetches fresh data when the sidebar remounts
instead of holding onto stale cache across navigations.
This commit is contained in:
2026-06-07 22:10:44 +02:00
parent f6c0f7a507
commit 82f2a40269

View File

@@ -83,7 +83,8 @@
const foldersQuery = createQuery<PpFolder[]>(() => ({
queryKey: ['folders'],
queryFn: listFolders,
enabled: isAuthenticated()
enabled: isAuthenticated(),
gcTime: 0
}));
// View counts come from PhotoPrism's `/config` response, which carries a
@@ -736,6 +737,8 @@
</div>
{#if foldersQuery.isPending}
<InlineLoader size="sm" label="Loading folders…" />
{:else if foldersQuery.isError}
<EmptyState size="compact" tone="destructive" icon={FolderOpen} title="Failed to load folders" description="Try reloading the page." />
{:else if !hasSubfolders}
<EmptyState size="compact" icon={FolderOpen} title="No subfolders" />
{:else if rootExpanded}