soulsync/webui/src/routes/import/route.tsx
Antti Kettunen e2a760bd68
fix(webui): keep import pages cache-aware
- keep the /import loader from turning transient staging fetch failures into route errors
- keep cached auto-import status and results visible during refetch failures
- show inline notices only when there is no stale data to fall back to
- add regression coverage for staging, status, and results failure paths
2026-05-24 21:17:22 +03:00

22 lines
797 B
TypeScript

import { createFileRoute, redirect } from '@tanstack/react-router';
import { getProfileHomePath } from '@/platform/shell/bridge';
import { importStagingFilesQueryOptions } from './-import.api';
import { ImportPage } from './-ui/import-page';
export const Route = createFileRoute('/import')({
beforeLoad: ({ context }) => {
const { bridge } = context.shell;
if (!bridge.isPageAllowed('import')) {
throw redirect({ href: getProfileHomePath(bridge), replace: true });
}
},
loader: ({ context }) => {
// Warm the staging query if possible, but never block the route on a transient fetch
// failure. The page owns the in-place error state for that case.
void context.queryClient.prefetchQuery(importStagingFilesQueryOptions());
},
component: ImportPage,
});