fix(cloud): prevent reprompting users to onboard after first signup

This commit is contained in:
Henry
2026-05-16 22:34:56 +01:00
parent 69ed5fd8f2
commit 742e8a1fab

View File

@@ -58,9 +58,12 @@ export const WorkspaceProvider: React.FC<{ children: ReactNode }> = ({
const pollAttemptsRef = React.useRef(0); const pollAttemptsRef = React.useRef(0);
const MAX_POLL_ATTEMPTS = 5; const MAX_POLL_ATTEMPTS = 5;
const { data, isLoading } = api.workspace.all.useQuery(undefined, { const { data, isLoading, isFetching } = api.workspace.all.useQuery(
refetchInterval: pendingWorkspaceId ? 2000 : false, undefined,
}); {
refetchInterval: pendingWorkspaceId ? 2000 : false,
},
);
const utils = api.useUtils(); const utils = api.useUtils();
const switchWorkspace = (_workspace: Workspace) => { const switchWorkspace = (_workspace: Workspace) => {
@@ -76,7 +79,7 @@ export const WorkspaceProvider: React.FC<{ children: ReactNode }> = ({
useEffect(() => { useEffect(() => {
if (!data?.length) { if (!data?.length) {
if (!isLoading) setHasLoaded(true); if (!isLoading && !isFetching) setHasLoaded(true);
return; return;
} }
@@ -148,7 +151,7 @@ export const WorkspaceProvider: React.FC<{ children: ReactNode }> = ({
cardPrefix: primaryWorkspace.cardPrefix, cardPrefix: primaryWorkspace.cardPrefix,
}); });
} }
}, [data, isLoading, workspacePublicId, router]); }, [data, isLoading, isFetching, workspacePublicId, router]);
return ( return (
<WorkspaceContext.Provider <WorkspaceContext.Provider