diff --git a/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts b/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts index eea2aca08..e31f9a3f3 100644 --- a/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts +++ b/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts @@ -184,17 +184,17 @@ export function useUiEditorSession( const [isSaving, setIsSaving] = useState(false); const [generateError, setGenerateError] = useState(null); const [isGenerating, setIsGenerating] = useState(false); + const normalizedInitialStep = + initialStep === 'visual-binding' ? 'structure-recognition' : initialStep; const normalizedInitialStepIndex = - initialStep === 'reference-analysis' - ? 0 - : initialStep === 'structure-recognition' - ? 1 - : 1; + normalizedInitialStep === 'reference-analysis' ? 0 : 1; const normalizedInitialFurthestStepIndex = Math.max( normalizedInitialStepIndex, Math.min(1, Math.max(0, Math.trunc(initialFurthestStepIndex))), ); - const [activeStep, setActiveStep] = useState(initialStep); + const [activeStep, setActiveStep] = useState( + normalizedInitialStep, + ); const [furthestStepIndex, setFurthestStepIndex] = useState( normalizedInitialFurthestStepIndex, ); @@ -244,7 +244,7 @@ export function useUiEditorSession( const [hasBound, setHasBound] = useState(false); useEffect(() => { - setActiveStep(initialStep); + setActiveStep(normalizedInitialStep); setFurthestStepIndex(normalizedInitialFurthestStepIndex); setPendingWorkflowStepChange(null); if (!resourceId) { @@ -348,6 +348,7 @@ export function useUiEditorSession( }; }, [ initialStep, + normalizedInitialStep, normalizedInitialFurthestStepIndex, projectPath, replaceEditorState, @@ -649,12 +650,7 @@ export function useUiEditorSession( function enterStep(step: UiEditorStepId) { setActiveStep(step); - const index = - step === 'reference-analysis' - ? 0 - : step === 'structure-recognition' - ? 1 - : 1; + const index = step === 'reference-analysis' ? 0 : 1; setFurthestStepIndex((current) => Math.max(current, index)); }