Skip to content

Conversation

@chriszarate
Copy link
Contributor

What?

Real-time collaboration: Ensure block attribute from CRDT doc is a Y.Text instance before passing it to mergeRichTextUpdate.

Why?

Our assumption that an attribute is represented in the CRDT doc as a Y.Text instance was based on the incoming block name, which may have changed. For example, a block can be transformed from core/freeform to core/paragraph (both of which carry a content attribute).

When this happens, we can encounter a fatal error in mergeRichTextUpdate by assuming a primitive string is a Y.Text instance.

How?

  1. Use an instanceof check.
  2. Add a test case.

Testing Instructions

  1. Check out this branch.
  2. Add a "Classic" block.
  3. Click "Convert to blocks."

@chriszarate chriszarate requested a review from nerrad as a code owner October 27, 2025 21:50
@chriszarate chriszarate added [Feature] Real-time Collaboration Phase 3 of the Gutenberg roadmap around real-time collaboration [Type] Experimental Experimental feature or API. labels Oct 27, 2025
Copy link
Contributor

@alecgeatches alecgeatches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crazy bug find, and pretty simple-looking fix. Thank you!

@github-actions
Copy link

github-actions bot commented Oct 27, 2025

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: DAreRodz <darerodz@git.wordpress.org>
Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org>
Co-authored-by: chriszarate <czarate@git.wordpress.org>
Co-authored-by: alecgeatches <alecgeatches@git.wordpress.org>
Co-authored-by: pkevan <paulkevan@git.wordpress.org>
Co-authored-by: maxschmeling <maxschmeling@git.wordpress.org>
Co-authored-by: ingeniumed <ingeniumed@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@chriszarate chriszarate force-pushed the fix/block-transform-rich-text-error branch from d7d04d8 to edb19c9 Compare October 27, 2025 22:29
@chriszarate chriszarate merged commit bc99fc2 into wpvip/rtc-plugin Oct 27, 2025
10 checks passed
@chriszarate chriszarate deleted the fix/block-transform-rich-text-error branch October 27, 2025 22:37
@github-actions
Copy link

Flaky tests detected in d7d04d8.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18856954927
📝 Reported issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Real-time Collaboration Phase 3 of the Gutenberg roadmap around real-time collaboration [Type] Experimental Experimental feature or API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants