Skip to content

Conversation

@felixfeng33
Copy link
Collaborator

Checklist

  • yarn typecheck
  • yarn lint:fix
  • yarn test
  • yarn brl
  • yarn changeset
  • ui changelog

@codesandbox
Copy link

codesandbox bot commented Nov 29, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@changeset-bot
Copy link

changeset-bot bot commented Nov 29, 2025

🦋 Changeset detected

Latest commit: 98c1306

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@platejs/yjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 29, 2025
@vercel
Copy link

vercel bot commented Nov 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
plate Ready Ready Preview Comment Nov 29, 2025 1:56am

@claude
Copy link
Contributor

claude bot commented Nov 29, 2025

Claude finished @felixfeng33's task —— View job


Changeset Created ✅

I've analyzed the PR and created the appropriate changeset:

Changes Made:

  • ✅ Created changeset file: .changeset/yjs-patch-missing-id.md (patch)
  • ✅ No changelog update needed (no registry component changes)

Summary:

This PR fixes a missing id parameter in the BaseYjsPlugin initialization. The plugin now:

  • Correctly passes the id to slateToDeterministicYjsState
  • Waits for provider sync before applying initial values
  • Prevents overwriting server data by checking if ydoc is empty

The changeset has been committed to your PR branch and should now be picked up by the changeset bot.

@dosubot dosubot bot added patch Bugfix & documentation PR plugin:yjs labels Nov 29, 2025
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 296 to 301
// After sync, check if ydoc has content from server
const sharedRoot = ydoc.get('content', Y.XmlText) as Y.XmlText;

// Only apply initial value if ydoc is empty (no content from server)
if (sharedRoot.length === 0 && value !== null) {
let initialNodes = value as Value;

Choose a reason for hiding this comment

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

P1 Badge Avoid overwriting synced custom shared types

After waiting for providers to sync, the code decides whether to seed the document by checking only ydoc.get('content', Y.XmlText).length === 0. When a custom shared type is supplied and already populated by the provider, the default content key remains empty, so this branch still runs and customSharedType.applyDelta re-seeds the doc, overwriting/duplicating the server state for custom shared types. The emptiness check should use the custom shared type (or skip seeding after a successful sync) to avoid data loss when custom shared types carry the actual content.

Useful? React with 👍 / 👎.

@felixfeng33 felixfeng33 changed the title fix missing id Revert #4755 and fixes content duplicated. Nov 29, 2025
@felixfeng33 felixfeng33 merged commit b5e5b66 into main Nov 29, 2025
3 checks passed
@felixfeng33 felixfeng33 deleted the fix/yjs-missing-id branch November 29, 2025 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bugfix & documentation PR plugin:yjs size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants