[WEB-1748] fix: onboarding infinite loading issue. (#4961)
This commit is contained in:
parent
b5a2e5c727
commit
589576257e
1 changed files with 8 additions and 20 deletions
|
|
@ -43,25 +43,13 @@ const OnboardingPage = observer(() => {
|
|||
// computed values
|
||||
const workspacesList = Object.values(workspaces ?? {});
|
||||
// fetching workspaces list
|
||||
const { isLoading: workspaceListLoader } = useSWR(
|
||||
USER_WORKSPACES_LIST,
|
||||
() => {
|
||||
user?.id && fetchWorkspaces();
|
||||
},
|
||||
{
|
||||
shouldRetryOnError: false,
|
||||
}
|
||||
);
|
||||
const { isLoading: workspaceListLoader } = useSWR(USER_WORKSPACES_LIST, () => {
|
||||
user?.id && fetchWorkspaces();
|
||||
});
|
||||
// fetching user workspace invitations
|
||||
const { data: invitations } = useSWR(
|
||||
"USER_WORKSPACE_INVITATIONS_LIST",
|
||||
() => {
|
||||
user?.id && workspaceService.userWorkspaceInvitations();
|
||||
},
|
||||
{
|
||||
shouldRetryOnError: false,
|
||||
}
|
||||
);
|
||||
const { isLoading: invitationsLoader, data: invitations } = useSWR("USER_WORKSPACE_INVITATIONS_LIST", () => {
|
||||
if (user?.id) return workspaceService.userWorkspaceInvitations();
|
||||
});
|
||||
// handle step change
|
||||
const stepChange = async (steps: Partial<TOnboardingSteps>) => {
|
||||
if (!user) return;
|
||||
|
|
@ -144,7 +132,7 @@ const OnboardingPage = observer(() => {
|
|||
|
||||
return (
|
||||
<AuthenticationWrapper pageType={EPageTypes.ONBOARDING}>
|
||||
{user && totalSteps && step !== null && invitations ? (
|
||||
{user && totalSteps && step !== null && !invitationsLoader ? (
|
||||
<div className={`flex h-full w-full flex-col`}>
|
||||
{step === EOnboardingSteps.PROFILE_SETUP ? (
|
||||
<ProfileSetup
|
||||
|
|
@ -155,7 +143,7 @@ const OnboardingPage = observer(() => {
|
|||
/>
|
||||
) : step === EOnboardingSteps.WORKSPACE_CREATE_OR_JOIN ? (
|
||||
<CreateOrJoinWorkspaces
|
||||
invitations={invitations}
|
||||
invitations={invitations ?? []}
|
||||
totalSteps={totalSteps}
|
||||
stepChange={stepChange}
|
||||
finishOnboarding={finishOnboarding}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue