Prevent using the editorStore when it isn't available (see #69)#71
Closed
elcapo wants to merge 1 commit intomtoensing:masterfrom
elcapo:master
Closed
Prevent using the editorStore when it isn't available (see #69)#71elcapo wants to merge 1 commit intomtoensing:masterfrom elcapo:master
elcapo wants to merge 1 commit intomtoensing:masterfrom
elcapo:master
Conversation
Owner
|
I will check. |
Owner
|
Thanks! |
Owner
|
Here’s what I’d check before merging: If you only need block-editor state, consider swapping any core/editor calls for core/block-editor where possible; core/editor is brittle in non-post editors.
If you’re using hooks like useSelect, ensure the selector returns a stable value and the guard prevents unnecessary rerenders. If it’s a one-off check, using select() outside render (e.g., in an effect) may reduce churn. |
Owner
|
and it is not obvious why we need such a hack. The widgets menu is deprecated, isn't it? Same applies to this case: #69 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @mtoensing,
Here's my second attempt at fixing #69. I did some checks and now:
It still doesn't work from the widgets screen but that makes sense as there is no related post available.
Please, double check before merging, just in case I'm still missing something. Feel free to discard both the PR and the issue if you think it doesn't worth the fix.
Here's what I did:
editorStorewith a constant that catches it if it's available. That causesnpm run buildto not include wp-editor as a dependency but still uses it when it's available (ex. Gutenberg editor).editorStoreisn't used when it's not available (ex. the widget screen).Thanks for the patience!