-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Rotate unlock string for GB unstable APIs in Calypso apps v18.7.0 #92384
Rotate unlock string for GB unstable APIs in Calypso apps v18.7.0 #92384
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~77 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~144 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
@okmttdhr, just a heads-up that as part of my GB release I'm updating these unlock strings that were introduced in:
Let me know if you have any suggestion for a more solid fix. |
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
@@ -17,7 +17,10 @@ export const getUnlock = () => { | |||
let unlock: ( object: any ) => any | undefined; | |||
try { | |||
unlock = __dangerousOptInToUnstableAPIsOnlyForCoreModules( | |||
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', | |||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |||
( window as any ).wpcomGutenberg?.pluginVersion?.startsWith( 'v18.7' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing this, @sejas!
I believe we should support => v18.7
as well (e.g., v18.8, v19.x, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!, my plan is to remove the condition and the old string once I've deployed the new GB version!
I've created this issue to track it!
https://github.com/Automattic/dotcom-forge/issues/8118
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script also runs on Atomic, so I thought we should continue supporting the old string 🥲
(Sorry if I misunderstand something)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After investigating, I've found that window.wpcomGutenberg.pluginVersion
is not accessible in Atomic sites.
I also think users cannot install other Gutenberg versions since it's a managed plugin. In the same way, users cannot use a different WP version. I've confirmed that users can install different GB plugin versions.
What's true is that users can deactivate the Gutenberg plugin, and then the unlock would need the previous string version.
One last thought is that we don't support the previous string version I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.
I've asked for help in Slack p1720180332965009-slack-C7YPUHBB2 about how to handle Atomic sites. |
Confirmed, we just need to support the "latest" unlock string even for atomic sites: |
…2384) * Rotate Gutenberg unlock string for unstable APIs * Handle temporarily both string versions to be able to pass tests and deploy before releasing GB
…2384) * Rotate Gutenberg unlock string for unstable APIs * Handle temporarily both string versions to be able to pass tests and deploy before releasing GB
Note
This PR should be released just after v18.7.0 is available in simple sites.
Proposed Changes
Previous String:
I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.
New String:
I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.
My Plan is to remove the condition and the old string once I've deployed the new GB version. https://github.com/Automattic/dotcom-forge/issues/8118
Why are these changes being made?
Testing Instructions
yarn dev --sync
widgets.wp.com
https://20240701gutenbergrotation.wordpress.com/wp-admin/post.php?post=2&action=edit
Error: Unable to get the unlock api. Reason: Error: You tried to opt-in to unstable APIs without confirming you know the consequences.
gutenberg-edge
sticker.Test in atomic sites:
Pre-merge Checklist