File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -371,6 +371,16 @@ async function waitForIcons(page: Page) {
371371 return true ;
372372 }
373373
374+ const state = icon . getAttribute ( 'data-argos-state' ) ;
375+
376+ if ( state === 'pending' ) {
377+ return false ;
378+ }
379+
380+ if ( state === 'loaded' ) {
381+ return true ;
382+ }
383+
374384 // url("https://ka-p.fontawesome.com/releases/v6.6.0/svgs/light/moon.svg?v=2&token=a463935e93")
375385 const maskImage = window . getComputedStyle ( icon ) . getPropertyValue ( 'mask-image' ) ;
376386 const urlMatch = maskImage . match ( / u r l \( " ( [ ^ " ] + ) " \) / ) ;
@@ -384,8 +394,14 @@ async function waitForIcons(page: Page) {
384394 // If the URL is already queued for loading, we return the state.
385395 if ( urlStates [ url ] ) {
386396 if ( urlStates [ url ] === 'loaded' ) {
387- icon . setAttribute ( 'data-bust' , String ( Date . now ( ) ) ) ;
388- return true ;
397+ icon . setAttribute ( 'data-argos-state' , 'pending' ) ;
398+ const bck = icon . style . maskImage ;
399+ icon . style . maskImage = '' ;
400+ requestAnimationFrame ( ( ) => {
401+ icon . style . maskImage = bck ;
402+ icon . setAttribute ( 'data-argos-state' , 'loaded' ) ;
403+ } ) ;
404+ return false ;
389405 }
390406
391407 return false ;
You can’t perform that action at this time.
0 commit comments