Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEOS-1499:updates guide to be null until its initialized #2769

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { useQueryClient } from '@tanstack/react-query';
import { ReactElement, useEffect, useState } from 'react';
import { toast } from 'sonner';
import { useAccount } from '../providers/account-provider';
import { Skeleton } from '../ui/skeleton';
import Configure from './Configure';
import Connect from './Connect';
import StepProgress from './StepProgress';
Expand Down Expand Up @@ -59,7 +58,7 @@ export default function WelcomeDialog(): ReactElement {

const [currentStep, setCurrentStep] = useState<FormStepName>('welcome');
const [isSubmitting, setIsSubmitting] = useState<boolean>(false);
const [showGuide, setShowGuide] = useState<boolean>(false);
const [showGuide, setShowGuide] = useState<boolean | null>(null);

const handleNextStep = () => {
setCurrentStep((prev) => {
Expand Down Expand Up @@ -175,20 +174,14 @@ export default function WelcomeDialog(): ReactElement {
}

useEffect(() => {
if (error || isLoading) {
return;
if (!isLoading && !error && !isValidating && data) {
setShowGuide(!data.config?.hasCompletedOnboarding);
}
}, [isLoading, isValidating, error, data]);

setShowGuide(!data?.config?.hasCompletedOnboarding);
}, [isLoading, isValidating, error, data?.config?.hasCompletedOnboarding]);

if (isLoading) {
return <Skeleton />;
}
if (!showGuide) {
return <></>;
}

const stepOrder: FormStepName[] = multiStepForm.map((item) => {
return item.name;
});
Expand Down