Setup yjs dependency#47261
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
463b4ac to
1e909ad
Compare
There was a problem hiding this comment.
Pull request overview
This PR configures Yjs dependency management to ensure a single instance is used across the application, preventing conflicts with shared document types. The change addresses the known Yjs issue where multiple instances break shared document functionality.
Changes:
- Added
@wordpress/sync,yjs,lib0, andy-protocolsas dependencies - Configured webpack externals to map both
@wordpress/syncandyjsto WordPress globals - Converted gutenberg-rtc entry point from
.jsto.ts
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| projects/packages/jetpack-mu-wpcom/webpack.config.js | Added webpack externals configuration to resolve @wordpress/sync and yjs to WordPress globals, updated entry point file extension |
| projects/packages/jetpack-mu-wpcom/package.json | Added @wordpress/sync, yjs, lib0, and y-protocols package dependencies |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
449c688 to
5e0223e
Compare
|
I'll move this forward 🙂 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 5 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Resolve Yjs to the global `wp.sync.Y` to avoid two separate Yjs | ||
| // instances, which breaks shared document types. See: | ||
| // https://github.com/yjs/yjs/issues/438 | ||
| yjs: 'wp.sync.Y', |
There was a problem hiding this comment.
@anomiex should this go through jetpackWebpackConfig.DependencyExtractionPlugin()?
There was a problem hiding this comment.
The @wordpress/sync should already do so. I'd be worried that adding it here might break the addition of wp-sync to the .asset.php file, although assuming this got tested presumably it didn't. I'd still remove it here.
yjs won't be handled by DependencyExtractionPlugin by default. I suppose doing it via DependencyExtractionPlugin would probably be better, although you'd have to make sure to configure the added requestMap entry to call for the "wp-sync" handle rather than something like "yjs" that won't actually be registered with WordPress.
There was a problem hiding this comment.
Although, I note that the testing code does import { Y } from '@wordpress/sync'; rather than importing yjs directly, so it shouldn't be needed here (or as a dependency at all) in the first place.
There was a problem hiding this comment.
The
@wordpress/syncshould already do so.
Not the current version of Dependency Extraction plugin because the sync package was recently removed from the bundled packages list. It also means that we will have to think of WP compatibility here where wp.sync won’t be available.
There was a problem hiding this comment.
WordPress/gutenberg#74671 was included in @wordpress/dependency-extraction-webpack-plugin v6.40.0, which we updated to in #47300.
WP compatibility will be a concern if wp-sync isn't registered by WordPress 6.9. But in that case the exclusion here is still wrong.
There was a problem hiding this comment.
The code for the provider will eventually be moved to widgets.wp.com as calypso app to provide support for WoA and self-hosted JP sites.
We were looking to move fast to provide testing sites for the upcoming feature.
Fixes DOTCOM-16099
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Changelog