@@ -46,6 +46,21 @@ const Connections = (props) => {
4646 const updatedConnection = van . state ( connection ) ;
4747 const formState = van . state ( { dirty : false , valid : false } ) ;
4848
49+ // Build the wizard once on first appearance and keep the same instance
50+ // across reruns so internal state (currentStepIndex, form values) is not
51+ // reset. Re-creating it would send the user back to step 0 every time
52+ // Streamlit reruns (e.g. after PreviewTableGroupClicked).
53+ let wizardComponent ;
54+ const buildWizard = ( ) => TableGroupWizard ( { emit,
55+ project_code : van . derive ( ( ) => getValue ( props . setup_wizard ) ?. project_code ) ,
56+ table_group : van . derive ( ( ) => getValue ( props . setup_wizard ) ?. table_group ) ,
57+ table_group_preview : van . derive ( ( ) => getValue ( props . setup_wizard ) ?. table_group_preview ) ,
58+ steps : van . derive ( ( ) => getValue ( props . setup_wizard ) ?. steps ) ,
59+ dialog : van . derive ( ( ) => getValue ( props . setup_wizard ) ?. dialog ) ,
60+ results : van . derive ( ( ) => getValue ( props . setup_wizard ) ?. results ) ,
61+ standard_cron_sample : van . derive ( ( ) => getValue ( props . setup_wizard ) ?. standard_cron_sample ) ,
62+ monitor_cron_sample : van . derive ( ( ) => getValue ( props . setup_wizard ) ?. monitor_cron_sample ) ,
63+ } ) ;
4964
5065 return div (
5166 { id : wrapperId , 'data-testid' : 'connections' , class : 'flex-column fx-gap-4' } ,
@@ -110,9 +125,14 @@ const Connections = (props) => {
110125 } ,
111126 ) ,
112127 ( ) => {
113- const wizardData = getValue ( props . setup_wizard ) ;
114- if ( ! wizardData ) return div ( ) ;
115- return TableGroupWizard ( wizardData , emit ) ;
128+ // Once built, always return the same instance so the wizard stays
129+ // mounted (its Dialog handles its own open/close via display:none).
130+ // Returning a fresh node on rerun would unmount and break VanJS
131+ // bindings inside the wizard.
132+ if ( ! getValue ( props . setup_wizard ) && ! wizardComponent ) {
133+ return '' ;
134+ }
135+ return wizardComponent ??= buildWizard ( ) ;
116136 } ,
117137 ) ;
118138}
0 commit comments