22* <license header>
33*/
44
5- import React , { useState , useCallback , useEffect } from 'react'
5+ import React , { useState , useCallback } from 'react'
66import { AlertDialog , Badge , Button , DialogTrigger , Heading , ProgressBar , StatusLight , Text } from '@react-spectrum/s2'
77import { style , iconStyle } from '@react-spectrum/s2/style' with { type : 'macro' }
88import { useNavigate } from 'react-router-dom'
@@ -19,7 +19,6 @@ import {
1919 TYPOGRAPHY
2020} from '../../styles/designSystem'
2121import { formatEventFormStatusLabel , getEventFormStatusLightVariant } from './eventFormStatusBadge'
22- import { loadFormStep , saveFormStep } from '../../utils/formPersistence'
2322
2423export interface WizardStep {
2524 id : string
@@ -81,8 +80,6 @@ interface FormWizardProps {
8180 sessionContent ?: React . ReactNode
8281 /** True when an inline session form (add or edit) is currently open */
8382 sessionHasOpenForm ?: boolean
84- /** Key to persist the current step under (sessionStorage) so it survives a remount. Omit to disable persistence. */
85- stepPersistKey ?: string
8683}
8784
8885/** Side nav: Dashboard row hover */
@@ -115,18 +112,8 @@ export const FormWizard: React.FC<FormWizardProps> = ({
115112 testIds,
116113 sessionContent,
117114 sessionHasOpenForm = false ,
118- stepPersistKey,
119115} ) => {
120- const [ currentStepIndex , setCurrentStepIndex ] = useState ( ( ) => {
121- if ( ! stepPersistKey ) return 0
122- const persisted = loadFormStep ( stepPersistKey )
123- if ( persisted === null ) return 0
124- // Never restore past a step the user has actually unlocked — a stale
125- // persisted step (e.g. from an abandoned draft under a shared "new
126- // event" key) must not open an inaccessible step with no data.
127- const highestUnlocked = hasEventId ? maxStepReached : 0
128- return Math . min ( persisted , highestUnlocked , steps . length - 1 )
129- } )
116+ const [ currentStepIndex , setCurrentStepIndex ] = useState ( 0 )
130117 const [ isNavigating , setIsNavigating ] = useState ( false )
131118 const [ showSessionView , setShowSessionView ] = useState ( false )
132119 const [ pendingAction , setPendingAction ] = useState < 'save' | 'publish' | 'next' | null > ( null )
@@ -140,14 +127,6 @@ export const FormWizard: React.FC<FormWizardProps> = ({
140127 const isFirstStep = currentStepIndex === 0
141128 const progress = ( ( currentStepIndex + 1 ) / steps . length ) * 100
142129
143- // Persist the current step so it survives a remount of the wizard
144- // (e.g. a background auth/group refresh) instead of resetting to step 1.
145- useEffect ( ( ) => {
146- if ( stepPersistKey ) {
147- saveFormStep ( stepPersistKey , currentStepIndex )
148- }
149- } , [ stepPersistKey , currentStepIndex ] )
150-
151130 // Determine if a step is accessible
152131 const isStepAccessible = useCallback ( ( stepIndex : number ) : boolean => {
153132 if ( stepIndex === 0 ) return true
0 commit comments