-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Widget Screen: Problem with updating widgets #69704
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
base: trunk
Are you sure you want to change the base?
Conversation
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @JelleTempelman. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
|
Tested this patch: |
|
Continuing discussion from the issue. It seems odd that the issue only affects the paragraph block, but no other blocks have "splitting" support enabled. We should avoid hardcoded special cases for blocks as much as possible. I think there could be a different root cause of the problem that we might be overlooking here. |
|
@Mamaduka Thanks for the feedback! Based on my analysis and the changes made.
Changes Made
This approach avoids hardcoded block-specific handling while addressing the root cause of the issue. Let me know if you have any thoughts! |
Mamaduka
left a comment
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.
Thanks for working on this, @snehapatil2001!
Unfortunately, I don't think that modifying the block-editor package is the right approach here (see the inline comment). It's been a while since I worked on Widget packages, so it's hard for me to suggest a better alternative 😞
I know that the previous solution of removing __internalWidgetId worked, but entirely removing attributes before saving might have other consequences, which need to be adequately tested.
Related #29693.
| // Add widget ID clearance for same-block splits | ||
| ...( blockA.clientId === blockB.clientId && { | ||
| __internalWidgetId: undefined, | ||
| } ), |
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.
I don't think adding a special case to the block-editor package is a good option. Why?
- The
block-editordoesn't need to know about Widget editor specifics. The__internalWidgetIdis an internal ID for that screen. - What happens when we have more unique attributes like
__internalWidgetId? Do we keep maintaining the list?
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.
@Mamaduka Understood—I'll revert the block-editor changes. Please let me know if any other changes are required.
What?
Closes #69702.
Fixes an issue where pressing Enter within a paragraph block in the Widgets Editor would cause the save operation to hang indefinitely. The problem occurred when splitting paragraphs by adding line breaks between words.
Why?
The root cause was duplicate
__internalWidgetIdvalues being maintained when a paragraph splits:How?
__internalWidgetIdfor paragraph blocks before savingprocessedBlocksto maintain clean data flowupdatedPostfor consistencyTesting Instructions
Screenshots or screencast
Screen.Recording.2025-03-26.at.3.54.43.AM.mov