-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Widgets: Temporary fix for saving widgets #28078
Merged
Merged
Conversation
This file contains 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
noisysocks
added
[Type] Regression
Related to a regression in the latest release
[Feature] Widgets Screen
The block-based screen that replaced widgets.php.
labels
Jan 11, 2021
noisysocks
requested review from
adamziel,
draganescu,
ellatrix,
kevin940726,
talldan and
tellthemachines
as code owners
January 11, 2021 03:47
kevin940726
approved these changes
Jan 11, 2021
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.
Let's get it in first 😆
Size Change: +82 B (0%) Total Size: 1.3 MB
ℹ️ View Unchanged
|
Fixes two issues with saving widgets on the widgets screen: 1. Unable to save a new widget. What's happening here is that `saveEntityRecord()` passes execution back to `saveWidgetArea()` before it has a chance to call `addToBatch`. This means that nothing is in the batch processing queue when `processBatch()` is called. The temporary fix is to wait for a promise before calling `processBatch()`. This allows execution in `saveEntityRecord()` to resume. 2. Unable to save existing widgets. What's happening here is that the client IDs are changed by `useBlockSync()`. This breaks the internal mapping that the widget editor maintains of widget IDs <-> block client IDs. The temporary fix is to have the widgets editor pass a prop to `useBlockSync()` that disables cloning blocks.
noisysocks
force-pushed
the
fix/saving-widgets
branch
from
January 11, 2021 06:30
c768f92
to
f11024f
Compare
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Feature] Widgets Screen
The block-based screen that replaced widgets.php.
[Type] Regression
Related to a regression in the latest release
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.
Temporary fix for two regressions that prevent saving widgets in the widgets screen. This screen is currently shown to all users of the Gutenberg plugin.
While I work on fixing this properly, I want to ship a temporary fix in 9.8 as these are very prominent regressions that are resulting in a lot of comments from users in #27173 and in the support forums. It also unblocks work on the widgets screen.
Fixes two issues with saving widgets on the widgets screen:
Unable to save a new widget. What's happening here is that
saveEntityRecord()
passes execution back tosaveWidgetArea()
before it has a chance to calladdToBatch
. This means that nothing is in the batch processing queue whenprocessBatch()
is called. The temporary fix is to wait for a promise before callingprocessBatch()
. This allows execution insaveEntityRecord()
to resume. See Widgets editor: "There was an error. object Object" on save #27173 (comment).Unable to save existing widgets. What's happening here is that the client IDs are changed by
useBlockSync()
. This breaks the internal mapping that the widget editor maintains of widget IDs ↔ block client IDs. The temporary fix is to have the widgets editor pass a prop touseBlockSync()
that disables cloning blocks. See Allow using multiple controlled inner blocks refering to the same entity #27885 (comment).