Skip to content

fix(plugin-sdk-value): prevent transient duplicate remote pastes#3017

Merged
christianhg merged 1 commit into
mainfrom
fix/sdk-remote-paste-duplicate
Jul 23, 2026
Merged

fix(plugin-sdk-value): prevent transient duplicate remote pastes#3017
christianhg merged 1 commit into
mainfrom
fix/sdk-remote-paste-duplicate

Conversation

@ryanbonial

Copy link
Copy Markdown
Contributor

Description

Remote clipboard pastes can arrive as a temporary span insert followed by a text diff, while the cleanup unset reaches peers later. Receivers briefly rendered the pasted text twice.

Filter keyed inserted items that are absent from the SDK's current value before applying remote patches. The text diff still applies immediately.

What to review

  • packages/plugin-sdk-value/src/plugin.sdk-value.tsx: filters transient staged inserts from incoming remote patches.
  • packages/plugin-sdk-value/src/plugin.value-sync.browser.test.tsx: covers the staged insert plus text-diff sequence.

Testing

  • pnpm test:unit
  • pnpm test:browser:chromium
  • pnpm check:types
  • pnpm check:lint
  • pnpm build
  • Live two-browser clipboard-paste trace against the local build

Notes for release

Prevents remote editors from briefly displaying pasted plain text twice.

@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 43da00c

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

This PR includes changesets to release 1 package
Name Type
@portabletext/plugin-sdk-value 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

@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
portable-text-editor-documentation Ready Ready Preview, Comment Jul 23, 2026 5:18pm
portable-text-example-basic Ready Ready Preview, Comment Jul 23, 2026 5:18pm
portable-text-playground Ready Ready Preview, Comment Jul 23, 2026 5:18pm

Request Review

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Stats — @portabletext/editor

Compared against main (68b5d174)

@portabletext/editor

Metric Value vs main (68b5d17)
Internal (raw) 807.5 KB -
Internal (gzip) 155.1 KB -
Bundled (raw) 1.42 MB -
Bundled (gzip) 319.4 KB -
Import time 97ms +2ms, +1.6%

@portabletext/editor/behaviors

Metric Value vs main (68b5d17)
Internal (raw) 467 B -
Internal (gzip) 207 B -
Bundled (raw) 424 B -
Bundled (gzip) 171 B -
Import time 2ms -0ms, -0.8%

@portabletext/editor/plugins

Metric Value vs main (68b5d17)
Internal (raw) 2.7 KB -
Internal (gzip) 894 B -
Bundled (raw) 2.5 KB -
Bundled (gzip) 827 B -
Import time 7ms +0ms, +0.6%

@portabletext/editor/selectors

Metric Value vs main (68b5d17)
Internal (raw) 82.7 KB -
Internal (gzip) 15.4 KB -
Bundled (raw) 78.4 KB -
Bundled (gzip) 14.3 KB -
Import time 8ms +0ms, +1.8%

@portabletext/editor/traversal

Metric Value vs main (68b5d17)
Internal (raw) 28.1 KB -
Internal (gzip) 5.6 KB -
Bundled (raw) 28.1 KB -
Bundled (gzip) 5.5 KB -
Import time 6ms -0ms, -1.1%

@portabletext/editor/utils

Metric Value vs main (68b5d17)
Internal (raw) 30.6 KB -
Internal (gzip) 6.4 KB -
Bundled (raw) 28.2 KB -
Bundled (gzip) 6.1 KB -
Import time 6ms +0ms, +1.2%

🗺️ . · ./behaviors · ./plugins · ./selectors · ./traversal · ./utils · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

📦 Bundle Stats — @portabletext/markdown

Compared against main (68b5d174)

Metric Value vs main (68b5d17)
Internal (raw) 53.8 KB -
Internal (gzip) 9.8 KB -
Bundled (raw) 348.9 KB -
Bundled (gzip) 96.3 KB -
Import time 40ms +0ms, +0.6%

🗺️ View treemap · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

@ryanbonial
ryanbonial requested a review from christianhg July 23, 2026 17:19

@christianhg christianhg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks sensible! We can probably mitigate this in the editor engine by making it better at not producing scratch work. But that fix requires some more thought put into it and in the mean time this SDK mitigation makes sense to ship!

@christianhg
christianhg merged commit 9619f58 into main Jul 23, 2026
17 checks passed
@christianhg
christianhg deleted the fix/sdk-remote-paste-duplicate branch July 23, 2026 17:58
@ecoscript ecoscript Bot mentioned this pull request Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants