Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.

Home Page:https://jetpack.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boost: Css gen library not defined when premium expires

dilirity opened this issue · comments

Note

This is an edge-case, but it can happen.

This was introduced with #37118

If premium expires just as the user is generating cloud css and switches to another tab and then back to the old one, there will be an error about the css gen library not being present:

Image

The only way I reproduced this is locally.

Steps:

  • You'll need local boost cloud running with the boost developer plugin;
  • Use boost developer to enable premium;
  • Break css generation with the snippet below;
  • Request css generation;
  • Wait a bit and in another tab, from boost developer switch back to free;
  • Go back to the original tab and you should see the error.

Snippet:

<?php

add_action( 'template_redirect', function () {
	exit;
} );

I see two potential solutions:

  1. Update the message to suggest a page refresh to attempt to fix the issue.
  2. Load the library with JS if it doesn't exist like we previously did. By default, load it with enqueue script, but only load with JS if it's not already enqueued.