mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-30 10:49:55 -06:00
fix error during onboarding when environment not fully loaded (#459)
This commit is contained in:
@@ -24,7 +24,11 @@ interface OnboardingProps {
|
||||
}
|
||||
|
||||
export default function Onboarding({ session }: OnboardingProps) {
|
||||
const { data: environment, error } = useSWR(`/api/v1/environments/find-first`, fetcher);
|
||||
const {
|
||||
data: environment,
|
||||
error: isErrorEnvironment,
|
||||
isLoading: isLoadingEnvironment,
|
||||
} = useSWR(`/api/v1/environments/find-first`, fetcher);
|
||||
const { profile } = useProfile();
|
||||
const { triggerProfileMutate } = useProfileMutation();
|
||||
const [formbricksResponseId, setFormbricksResponseId] = useState<ResponseId | undefined>();
|
||||
@@ -36,7 +40,7 @@ export default function Onboarding({ session }: OnboardingProps) {
|
||||
return currentStep / MAX_STEPS;
|
||||
}, [currentStep]);
|
||||
|
||||
if (!profile) {
|
||||
if (!profile || isLoadingEnvironment) {
|
||||
return (
|
||||
<div className="flex h-full w-full items-center justify-center">
|
||||
<LoadingSpinner />
|
||||
@@ -44,7 +48,7 @@ export default function Onboarding({ session }: OnboardingProps) {
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
if (isErrorEnvironment) {
|
||||
return <div className="flex h-full w-full items-center justify-center">An error occurred</div>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user