diff --git a/src/renderer/src/components/onboarding/OnboardingFlow.tsx b/src/renderer/src/components/onboarding/OnboardingFlow.tsx index 06c168bc3..cc78da79a 100644 --- a/src/renderer/src/components/onboarding/OnboardingFlow.tsx +++ b/src/renderer/src/components/onboarding/OnboardingFlow.tsx @@ -185,6 +185,7 @@ export default function OnboardingFlow({ />
{ - return () => { - applyDocumentTheme(persistedThemeRef.current) - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) - useEffect(() => { void refreshPreflightStatus() }, [refreshPreflightStatus]) @@ -476,11 +466,18 @@ export function useOnboardingFlow( recordOnboardingTourDepthSummary(tourOutcomeTrackerRef.current, summary) }, []) - useEffect(() => { - return () => { + const setLifecycleRootRef = useCallback( + (node: HTMLElement | null): void => { + if (node !== null) { + return + } + // Why: onboarding previews theme/tour state outside this component; tie + // final cleanup to the modal root detaching instead of passive Effects. + applyDocumentTheme(persistedThemeRef.current) emitPendingTourOutcome() - } - }, [emitPendingTourOutcome]) + }, + [emitPendingTourOutcome] + ) const trackTaskSourcesSnapshot = useCallback( ( @@ -1395,6 +1392,7 @@ export function useOnboardingFlow( recordTourDepthSummary, back, jumpToStep, + setLifecycleRootRef, openFolder, continueWithExistingProject, openSshSettings,