Compare commits

...
Author SHA1 Message Date
loucass003 a5d7ee4303 lint 2026-05-04 17:04:12 +02:00
Sapphire 86c38c1052 Mark onboarding as done in onboardingEnded (#1830) 2026-05-04 16:04:39 +02:00
+23 -2
View File
@@ -1,4 +1,12 @@
import { createContext, Reducer, useContext, useLayoutEffect, useReducer } from 'react';
import {
createContext,
Reducer,
useContext,
useEffect,
useLayoutEffect,
useReducer,
useState,
} from 'react';
import { useLocation } from 'react-router-dom';
import { useConfig } from './config';
@@ -52,7 +60,8 @@ export function useProvideOnboarding(): OnboardingContext {
}
);
const { state: locatioState } = useLocation();
const { state: locatioState, pathname } = useLocation();
const [previousPath, setPreviousPath] = useState(pathname);
useLayoutEffect(() => {
const { alonePage = false }: { alonePage?: boolean } = (locatioState as any) || {};
@@ -61,6 +70,18 @@ export function useProvideOnboarding(): OnboardingContext {
dispatch({ type: 'alone-page', value: alonePage });
}, [locatioState, state]);
const onboardingEnded = () => {
setConfig({ doneOnboarding: true });
};
useEffect(() => {
setPreviousPath(pathname);
if (!pathname.startsWith('/onboarding') && previousPath.startsWith('/onboarding')) {
onboardingEnded();
}
}, [pathname]);
return {
state,
applyProgress: (value: number) => {