@@ -164,18 +164,15 @@ interface Credentials {
164164}
165165
166166function handleWorkflowActions ( workflow : any [ ] , credentials : Credentials ) {
167- // Process one step at a time to avoid memory issues
168167 return workflow . map ( step => {
169168 if ( ! step . what ) return step ;
170169
171- // Use a more memory-efficient approach
172170 const newWhat : any [ ] = [ ] ;
173171 const processedSelectors = new Set < string > ( ) ;
174172
175173 for ( let i = 0 ; i < step . what . length ; i ++ ) {
176174 const action = step . what [ i ] ;
177175
178- // Skip invalid actions
179176 if ( ! action ?. action || ! action ?. args ?. [ 0 ] ) {
180177 newWhat . push ( action ) ;
181178 continue ;
@@ -184,36 +181,30 @@ function handleWorkflowActions(workflow: any[], credentials: Credentials) {
184181 const selector = action . args [ 0 ] ;
185182 const credential = credentials [ selector ] ;
186183
187- // Handle non-credential actions
188184 if ( ! credential ) {
189185 newWhat . push ( action ) ;
190186 continue ;
191187 }
192188
193- // Handle credential-related actions
194189 if ( action . action === 'click' ) {
195190 newWhat . push ( action ) ;
196191
197- // If we haven't processed this selector and there's a following type/press action
198192 if ( ! processedSelectors . has ( selector ) &&
199193 i + 1 < step . what . length &&
200194 ( step . what [ i + 1 ] . action === 'type' || step . what [ i + 1 ] . action === 'press' ) ) {
201195
202- // Add type action
203196 newWhat . push ( {
204197 action : 'type' ,
205198 args : [ selector , encrypt ( credential . value ) , credential . type ]
206199 } ) ;
207200
208- // Add single waitForLoadState
209201 newWhat . push ( {
210202 action : 'waitForLoadState' ,
211203 args : [ 'networkidle' ]
212204 } ) ;
213205
214206 processedSelectors . add ( selector ) ;
215207
216- // Skip subsequent type/press/waitForLoadState actions for this selector
217208 while ( i + 1 < step . what . length &&
218209 ( step . what [ i + 1 ] . action === 'type' ||
219210 step . what [ i + 1 ] . action === 'press' ||
@@ -223,7 +214,6 @@ function handleWorkflowActions(workflow: any[], credentials: Credentials) {
223214 }
224215 } else if ( ( action . action === 'type' || action . action === 'press' ) &&
225216 ! processedSelectors . has ( selector ) ) {
226- // Handle standalone type/press action
227217 newWhat . push ( {
228218 action : 'type' ,
229219 args : [ selector , encrypt ( credential . value ) , credential . type ]
0 commit comments