Editing a Pattern Duplicates Authors When Saving from Post Editor #69485
Labels
[Feature] Patterns
A collection of blocks that can be synced (previously reusable blocks) or unsynced
[Feature] Saving
Related to saving functionality
[Type] Bug
An existing feature does not function as intended
Description
When editing a pattern from within a post editor, saving the pattern can result in duplicate author assignments. This appears to be caused by the block editor mixing context between the parent post and the pattern being edited.
This is with Co-Authors Plus active. Investigation has shown that the coauthors endpoint is being fed duplicate data, and that it is the block editor that is where the problem lies.
Investigation & Analysis
Through detailed logging of REST API requests and entity context, we discovered:
When saving a pattern from within a post editor, two contexts are active:
The sequence of events shows the issue:
The logs show that the block editor is retrieving author data from both:
(and is also failing to deduplicate the combined author list before sending the update)
Suggested Solution
The block editor should maintain clear separation between pattern and post contexts when handling author assignments. Specifically:
This would prevent the duplicate author assignments while maintaining the expected co-author functionality for both patterns and posts.
Notes
edit-post
area of the code handles this behavior as well.Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: