Skip to content

fix(Editor): call onCreate and onUpdate props - #7470

Open
lazerg wants to merge 1 commit into
nuxt:v4from
lazerg:fix/issue-7469-editor-callbacks
Open

lazerg wants to merge 1 commit into
nuxt:v4from
lazerg:fix/issue-7469-editor-callbacks

Conversation

@lazerg

@lazerg lazerg commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves #7469

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

The Editor spreads its props into useEditor, but then sets its own onCreate (placeholder refresh) and onUpdate (v-model sync) after the spread, so the onCreate and onUpdate passed as props were silently dropped. Other callbacks like onFocus worked because the component does not override them.

The internal handlers now call the user's callbacks too. onUpdate is called before the doc-changed check, so it still fires for every update Tiptap emits, same as using Tiptap directly.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
ui Ready Ready Preview Nov 23, 2026 1:55am UTC
ui-repl Ready Ready Preview Nov 23, 2026 1:55am UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Client output of the apps in test/bundle that changed, compared to the base branch.

Fixture JS (gzip) CSS (gzip)
nuxt-full 908.0 kB (+21 B, +0.0%) 29.3 kB
Raw sizes
Fixture JS CSS
nuxt-full 2846.1 kB (+40 B, +0.0%) 212.3 kB

@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The editor now forwards Tiptap’s onCreate and onUpdate events to the corresponding supplied callbacks. The onCreate handler retains the placeholder refresh. The onUpdate handler invokes the callback before the existing document-change check and model-value update logic. A test checks both callback invocations and the updated HTML emitted through update:modelValue.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Low

Merge Risk: Minimal · up to e7515

This change makes UEditor call the onCreate and onUpdate props, as users expect. It leaves the existing placeholder and v-model behavior unchanged, and no merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix (Editor forwarding the onCreate and onUpdate props), which matches the changeset: Editor.vue now calls the user callbacks, and the spec covers them. It is specific and concise,…
Description check Passed The description explains the cause: internal onCreate and onUpdate handlers overrode the user props after the spread into useEditor. It states the fix, which calls the user callbacks, and links issue …
Linked Issues check Passed [#7469] Objective: UEditor must invoke the user-supplied onCreate and onUpdate props. At the reviewed head, src/runtime/components/Editor.vue calls props.onCreate?.(event) inside the internal onCreate…
Out of Scope Changes check Passed The whole-PR diff against the merge base changes only src/runtime/components/Editor.vue (+8/-3 lines) and test/components/Editor.spec.ts (adds coverage for onCreate and onUpdate). Both changes impleme…
Full details: Title check

Explanation

The title names the fix (Editor forwarding the onCreate and onUpdate props), which matches the changeset: Editor.vue now calls the user callbacks, and the spec covers them. It is specific and concise, so it passes.

Full details: Description check

Explanation

The description explains the cause: internal onCreate and onUpdate handlers overrode the user props after the spread into useEditor. It states the fix, which calls the user callbacks, and links issue #7469. It is related to the changeset, so it passes.

Full details: Linked Issues check

Explanation

[#7469] Objective: UEditor must invoke the user-supplied onCreate and onUpdate props. At the reviewed head, src/runtime/components/Editor.vue calls props.onCreate?.(event) inside the internal onCreate handler, after the existing placeholder refresh. The internal onUpdate handler calls props.onUpdate?.(event) before the docChanged check, so it runs for every update Tiptap emits. The v-model sync (update:modelValue) remains behind the same docChanged check, as before. The diff touches no other behaviour. The PR adds a test in test/components/Editor.spec.ts that checks onCreate runs once and onUpdate runs once after a content change, with update:modelValue emitted. The test was read only through the summary; its execution was not verified. The objective is met by the code.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base changes only src/runtime/components/Editor.vue (+8/-3 lines) and test/components/Editor.spec.ts (adds coverage for onCreate and onUpdate). Both changes implement the linked objective. The onCreate handler rename from editor to event is a direct part of forwarding the callback. No unrelated changes were identified in the summary or the Editor.vue diff.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3650af7e-76f9-4a49-a760-589a8c4dc65c
Commits

Reviewing files that changed from the base of the PR and between 422d015 and e75156b.

Files selected for processing: 2

  • src/runtime/components/Editor.vue
  • test/components/Editor.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@codspeed

codspeed Bot commented Nov 23, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 41.38%

2 warnings

⚠️ 1 benchmark with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚠️ 1 benchmark with a significant change ran in a different software environment

Its base and head results were measured with a different OS or toolchain, such as compiler, runtime or library versions, so the change might come from this difference rather than from the code. Open the benchmark to see what changed.

See affected benchmarks

⚡ 1 improved benchmark
✅ 32 untouched benchmarks
⏩ 10 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ navigation-menu (~31 slots) 1,014 µs 717.2 µs +41.38%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing lazerg:fix/issue-7469-editor-callbacks (e75156b) with v4 (422d015)

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@pkg-pr-new

pkg-pr-new Bot commented Nov 23, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/ui@7470

commit: e75156b

This branch was successfully deployed

2 active deployments
Preview – ui — e75156bb Deployed Nov 23, 2026 by vercel[bot]
Preview – ui-repl — e75156bb Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UEditor: onUpdate and onCreate props are never called

1 participant