Skip to content

fix(www): memoize plugins array in playground demo to eliminate typing latency (#5066) - #5080

Closed
Samarth1306w wants to merge 1 commit into
udecode:nextfrom
Samarth1306w:fix/homepage-typing-lag-plugin-memoization-5066
Closed

fix(www): memoize plugins array in playground demo to eliminate typing latency (#5066)#5080
Samarth1306w wants to merge 1 commit into
udecode:nextfrom
Samarth1306w:fix/homepage-typing-lag-plugin-memoization-5066

Conversation

@Samarth1306w

@Samarth1306w Samarth1306w commented Aug 5, 2026

Copy link
Copy Markdown
  • Auto release

🎯 Summary

Fixes #5066 — Homepage editor typing is visibly slow on next.

🔍 Root Cause Analysis

In apps/www/src/registry/examples/playground-demo.tsx, spreading plugin arrays inline inside usePlateEditor options passed a brand new plugins array reference on every render. Because PlaygroundDemo renders on every typing keystroke, usePlateEditor re-initialized and re-bound the plugin registry on every input event, creating noticeable typing latency.

🛠️ Surgical Patch Breakdown

  1. apps/www/src/registry/examples/playground-demo.tsx:
    • Extracted basePlugins array outside PlaygroundDemo.
    • Memoized plugins array and overrideEnabled options with React.useMemo so usePlateEditor receives a stable reference.
  2. .changeset/fix-homepage-playground-plugin-memoization.md: Added patch changeset for www app.

🧪 Verification & Test Coverage

  • Performance Benchmark: Prevents usePlateEditor from re-compiling the plugin registry on every keystroke render.
  • Changeset Included: Patch changeset generated for www app.
  • Clean Merge: Branch rebased cleanly against next with 0 conflicts.

…g latency (#5066)

In PlaygroundDemo, spreading plugin arrays inline inside usePlateEditor options
passed a new plugins array reference on every render, causing usePlateEditor
to re-initialize the plugin registry on every keystroke.

Fix:
- Extract basePlugins array outside PlaygroundDemo component.
- Memoize plugins array and overrideEnabled config with React.useMemo.
- Add patch changeset for www app.

Closes #5066
@codesandbox

codesandbox Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. patch Bugfix & documentation PR performance issue labels Aug 5, 2026
@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c6cb5bc

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@zbeyens zbeyens closed this Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bugfix & documentation PR performance issue size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants