Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite reload if skip waiting enabled when Genesis sample theme active #183

Closed
westonruter opened this issue Jul 1, 2019 · 9 comments · Fixed by #187
Closed

Infinite reload if skip waiting enabled when Genesis sample theme active #183

westonruter opened this issue Jul 1, 2019 · 9 comments · Fixed by #187
Labels
bug Something isn't working
Milestone

Comments

@westonruter
Copy link
Collaborator

I noticed pages continuously reloading due to service worker updates when skip waiting is enabled. This is due to the deps in the revision for the offline template being variable each time the service worker is generated:

44c44
<         "revision": "0.3.0-alpha;genesis=3.0.1;genesis-sample=3.0.1;user=0;options=5507cd9816190d8097220350df40df52;nav=d751713988987e9331980363e24189ce;deps=61113d39fed531b502cf9b934c599f77;12d477fc3e67b6ae690cacd1bc2e1a94"
---
>         "revision": "0.3.0-alpha;genesis=3.0.1;genesis-sample=3.0.1;user=0;options=5507cd9816190d8097220350df40df52;nav=d751713988987e9331980363e24189ce;deps=7e2b6c61d5b7f1c1e8ccbdb7620fe57e;12d477fc3e67b6ae690cacd1bc2e1a94"
48c48
<         "revision": "0.3.0-alpha;genesis=3.0.1;genesis-sample=3.0.1;user=0;options=5507cd9816190d8097220350df40df52;nav=d751713988987e9331980363e24189ce;deps=61113d39fed531b502cf9b934c599f77;d6cad32f63360475e47fe587d5c479cf"
---
>         "revision": "0.3.0-alpha;genesis=3.0.1;genesis-sample=3.0.1;user=0;options=5507cd9816190d8097220350df40df52;nav=d751713988987e9331980363e24189ce;deps=7e2b6c61d5b7f1c1e8ccbdb7620fe57e;d6cad32f63360475e47fe587d5c479cf"
208c208
<     "revision": "0.3.0-alpha;genesis=3.0.1;genesis-sample=3.0.1;user=0;options=5507cd9816190d8097220350df40df52;nav=d751713988987e9331980363e24189ce;deps=61113d39fed531b502cf9b934c599f77"
---
>     "revision": "0.3.0-alpha;genesis=3.0.1;genesis-sample=3.0.1;user=0;options=5507cd9816190d8097220350df40df52;nav=d751713988987e9331980363e24189ce;deps=7e2b6c61d5b7f1c1e8ccbdb7620fe57e"

It may be due to a timestamp being used for the dependency revision.

@westonruter westonruter added the bug Something isn't working label Jul 1, 2019
@westonruter
Copy link
Collaborator Author

Using a timestamp for the asset ver is indeed the problem:

231c231
< 	<link rel='stylesheet' id='genesis-sample-css'  href='https://wordpressdev.lndo.site/content/themes/genesis-sample/style.css?ver=1562023927' type='text/css' media='all' />
---
> 	<link rel='stylesheet' id='genesis-sample-css'  href='https://wordpressdev.lndo.site/content/themes/genesis-sample/style.css?ver=1562023929' type='text/css' media='all' />
233c233
< <link crossorigin="anonymous" rel='stylesheet' id='genesis-sample-fonts-css'  href='https://fonts.googleapis.com/css?family=Source+Sans+Pro%3A400%2C400i%2C600%2C700&#038;display=swap&#038;ver=1562023927' type='text/css' media='all' />
---
> <link crossorigin="anonymous" rel='stylesheet' id='genesis-sample-fonts-css'  href='https://fonts.googleapis.com/css?family=Source+Sans+Pro%3A400%2C400i%2C600%2C700&#038;display=swap&#038;ver=1562023929' type='text/css' media='all' />
235c235
< <link rel='stylesheet' id='genesis-sample-gutenberg-css'  href='https://wordpressdev.lndo.site/content/themes/genesis-sample/lib/gutenberg/front-end.css?ver=1562023927' type='text/css' media='all' />
---
> <link rel='stylesheet' id='genesis-sample-gutenberg-css'  href='https://wordpressdev.lndo.site/content/themes/genesis-sample/lib/gutenberg/front-end.css?ver=1562023929' type='text/css' media='all' />

@ez360pic
Copy link

ez360pic commented Jul 3, 2019

I experience the infinite reload on the Avada platform, which comes with the PWA plugin, as have others who've reported this to Avada support. Is there a change Avada can make to avoid this problem? If not, will this bug be fixed in the future? If so, can you provide a rough timeframe for the update - days, weeks, months, a year? Thank you for the excellent app and help. Marc

@westonruter
Copy link
Collaborator Author

@ez360pic can you share the URL to your site with the plugin active so I can take a look to confirm whether it is the same issue?

I believe the crux of the problem is this code:

https://github.com/xwp/pwa-wp/blob/fee496164dc1028b8248640bc24b291b9397678d/wp-includes/components/class-wp-service-worker-navigation-routing-component.php#L336-L349

Namely, instead of doing:

$enqueued_scripts[ $handle ] = wp_scripts()->registered[ $handle ];

We should perhaps be doing:

$enqueued_scripts[ $handle ] = wp_scripts()->registered[ $handle ]->src;

Same for styles.

The problem I believe is that the ver for the assets is dynamic, using time() perhaps.

@ez360pic
Copy link

ez360pic commented Jul 3, 2019 via email

@westonruter
Copy link
Collaborator Author

@ez360pic Please test #187.

@ez360pic
Copy link

ez360pic commented Jul 3, 2019 via email

@westonruter
Copy link
Collaborator Author

@ez360pic How has testing gone?

@ez360pic
Copy link

ez360pic commented Jul 8, 2019 via email

@ez360pic
Copy link

ez360pic commented Jul 9, 2019 via email

@westonruter westonruter changed the title Infinite reload if skip waiting disabled when Genesis sample theme active Infinite reload if skip waiting enabled when Genesis sample theme active Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants