File tree Expand file tree Collapse file tree 2 files changed +23
-5
lines changed
features/wizard/components Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 1414 },
1515 {
1616 "id" : " Disability" ,
17- "name" : " My experience as someone with a disability or long term condition "
17+ "name" : " Disability & Long- term Conditions "
1818 },
1919 {
2020 "id" : " Colleague_Sharing" ,
Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ const StatementWizard: React.FC<StatementWizardProps> = ({
6565 category : '' ,
6666 } ) ;
6767 const [ isSubmitting , setIsSubmitting ] = useState ( false ) ;
68+ // Add a flag to prevent rapid multiple step transitions
69+ const [ isTransitioning , setIsTransitioning ] = useState ( false ) ;
6870
6971 // Initialize default values based on whether this is a preset or custom statement
7072 useEffect ( ( ) => {
@@ -123,11 +125,27 @@ const StatementWizard: React.FC<StatementWizardProps> = ({
123125 } ;
124126
125127 const goNext = ( ) => {
126- if ( currentStepIndex < steps . length - 1 ) {
127- setCurrentStepIndex ( ( prev ) => prev + 1 ) ;
128- } else {
129- handleComplete ( ) ;
128+ // Check if we're already in the middle of a transition
129+ if ( isTransitioning ) {
130+ return ; // Prevent multiple rapid transitions
130131 }
132+
133+ // Set transitioning flag to prevent additional advances
134+ setIsTransitioning ( true ) ;
135+
136+ // Add a small delay to prevent double-click issues
137+ setTimeout ( ( ) => {
138+ if ( currentStepIndex < steps . length - 1 ) {
139+ setCurrentStepIndex ( ( prev ) => prev + 1 ) ;
140+ } else {
141+ handleComplete ( ) ;
142+ }
143+
144+ // Reset transition flag after a slightly longer delay
145+ setTimeout ( ( ) => {
146+ setIsTransitioning ( false ) ;
147+ } , 300 ) ;
148+ } , 200 ) ; // 200ms delay to prevent step skipping
131149 } ;
132150
133151 const goBack = ( ) => {
You can’t perform that action at this time.
0 commit comments