@@ -408,38 +408,15 @@ function hideFormForInitialSubmission() {
408
408
rootNode . style . setProperty ( opacityVariableName , "1" ) ;
409
409
} ;
410
410
411
- /** @type {number | undefined } */
412
- let intervalId = undefined ;
413
- const pollingTimeoutMs = 5_000 ;
414
- let pollAttempts = 0 ;
415
-
416
- const checkIfSafeToHideForm = ( ) => {
417
- /** @type {HTMLFormElement | null } */
418
- const form = document . querySelector ( "web-client-form > form" ) ;
419
- if ( form === null ) {
420
- pollAttempts ++ ;
421
- const elapsedTime = pollAttempts * SCREEN_POLL_INTERVAL_MS ;
422
-
423
- if ( elapsedTime >= pollingTimeoutMs ) {
424
- restoreOpacity ( ) ;
425
- window . clearInterval ( intervalId ) ;
426
- }
427
-
428
- return ;
429
- }
430
-
431
- // If this file gets more complicated, it might make sense to set up the
432
- // timeout and event listener so that if one triggers, it cancels the other,
433
- // but having restoreOpacity run more than once is a no-op for right now.
434
- // Not a big deal if these don't get cleaned up.
435
- window . setTimeout ( restoreOpacity , 5_000 ) ;
436
- form . addEventListener ( "submit" , restoreOpacity , { once : true } ) ;
437
- } ;
411
+ // If this file gets more complicated, it might make sense to set up the
412
+ // timeout and event listener so that if one triggers, it cancels the other,
413
+ // but having restoreOpacity run more than once is a no-op for right now.
414
+ // Not a big deal if these don't get cleaned up.
438
415
439
- intervalId = window . setInterval (
440
- checkIfSafeToHideForm ,
441
- SCREEN_POLL_INTERVAL_MS ,
442
- ) ;
416
+ /** @type { HTMLFormElement | null } */
417
+ const form = document . querySelector ( "web-client-form > form" ) ;
418
+ form ?. addEventListener ( "submit" , restoreOpacity , { once : true } ) ;
419
+ window . setTimeout ( restoreOpacity , 5_000 ) ;
443
420
}
444
421
445
422
function setupFormOverrides ( ) {
0 commit comments