Repository navigation
Stabilize isPreviewMode flag - #66149
Conversation
|
Size Change: +96 B (+0.01%) Total Size: 1.81 MB
ℹ️ View Unchanged
|
c30246d to
72f81d3
Compare
|
Flaky tests detected in 72f81d3. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11355847467
|
…vate symbol within RichText block
e98aad3 to
7d80623
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
…etting when spreading the settings object
… defining a nested provider
youknowriad
left a comment
There was a problem hiding this comment.
This is looking good to me. Thanks :)
* Introduce stable isPreviewMode key and deprecate __unstableIsPreviewMode * Expose stable isPreviewMode as registry values * Use isPreviewMode instead of __unstableIsPreviewMode when accessing the setting * Access isPreviewMode directly from getSettings instead of through private symbol within RichText block * Revert private isPreviewMode changes * Add __unstableIsPreviewMode getter within settings reducer * Remove all other __unstableIsPreviewMode definitions * Define deprecation setter with Object.defineProperty to avoid eager getting when spreading the settings object * Use WP version within deprecation note * Add deprecation notice when trying to set __unstableIsPreviewMode in updateSettings * Add test to assert deprecated getters are passed to sub registry when defining a nested provider * Move deprecated setter logic to __experimentalUpdateSettings
Why?
It's been almost three years since we introduced
__unstableIsPreviewModeas a flag to indicate if the block is being rendered as part of the blocks list, block preview, pattern preview, etc. It's time to make it stable.I was motivated after Automattic/jetpack#39768 (comment).
How?
This PR adds
isPreviewModeas a new default setting key and alongside__unstableIsPreviewModewhenever it's used as a sub-registry value.Finally, I'm rewriting all internal usages of
__unstableIsPreviewModeto the newisPreviewModeflag.