fix(cloud): prevent reprompting users to onboard after first signup
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user