Skip to content

[WIKI-1268] chore: upgrade Tiptap and Hocuspocus to v3 - #10101

Merged
saivallampati merged 2 commits into
previewfrom
chore/WIKI-1268-tiptap-hocuspocus-v3
Oct 26, 2026
Merged

saivallampati merged 2 commits into
previewfrom
chore/WIKI-1268-tiptap-hocuspocus-v3

Conversation

@sriramveeraghanta

@sriramveeraghanta sriramveeraghanta commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Description

Upgrades the community editor and live server from Tiptap 2 / Hocuspocus 2 to Tiptap 3.31.3, @tiptap/y-tiptap 3.0.9 and Hocuspocus 3.4.4, ported from makeplane/plane-ee#9883. Stored Yjs documents and the editor schema are unchanged: no data migration, and pages written by v3 still open in a v2 client (checked), so rollback is safe.

Editor (packages/editor)

  • Bubble menu moves to @tiptap/react/menus (floating-ui). It re-shows after a drag selection, since v3 only re-evaluates on a selection/doc change.
  • AI menu drops tippy.js for @floating-ui/dom.
  • StarterKit v3 now bundles link, underline, list keymap and trailing node; those are turned off because Plane registers its own. history → undoRedo.
  • setContent calls use the v3 options form. CharacterCount/Placeholder come from @tiptap/extensions; y-prosemirror → @tiptap/y-tiptap.
  • New @plane/editor/server entry. v3's @tiptap/html throws outside a browser, so the HTML↔Yjs helpers are built from one factory (helpers/document-codecs.ts): the browser entries use @tiptap/html, the server entry uses @tiptap/html/server (happy-dom).
  • Placeholders are computed from the current view state, as in v2. v3's incremental placeholder reads the previous editor state and only rescans blocks a transaction touched. In practice a comment box lost its placeholder after typing and deleting, empty lines kept it after the caret left, and focus-dependent placeholders went stale. EE still ships with these. New regression tests fail on stock v3 and pass here.

Live (apps/live)

  • Codec imports move to @plane/editor/server. The title fragment is built with @tiptap/y-tiptap instead of the removed @hocuspocus/transformer.
  • Redis extension on the v3 API:
    • promise-based (un)subscribe, and publish with a Buffer;
    • Redlock re-created on the configured DB (it otherwise SELECTs DB 0);
    • waits for ioredis to be ready before subscribing.
  • Shutdown now drains pending saves and unload hooks before Redis disconnects, so edits aren't lost on deploy. The community compose file gives live a 30s stop_grace_period.

Dependencies

  • prosemirror-state/prosemirror-transform and the Tiptap bubble/floating menu packages are pinned so the graph keeps one copy of each (the menus otherwise resolve to 3.32.0 against core 3.31.3).
  • linkifyjs is deduped. v3's StarterKit pulls in a second copy.
  • Removed: tippy.js, y-prosemirror, @hocuspocus/transformer, @tiptap/extension-character-count, @tiptap/extension-placeholder.

Touched files also get the strict pre-commit lint fixes: named Tiptap imports and renamed shadowed variables.

Found while testing, older than this PR, not fixed here

  • apps/api/plane/bgtasks/page_version_task.py:63 reads page.description, which was renamed to description_json, so page versions are never created.
  • After restoring a version, the page view stays scrolled/clipped to the left.
  • React hydration error feat: issue filter views  #418 on load.
  • An occasional linkify "already initialized" console warning.

All four reproduce on a preview build.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

No intended visual change.

Test Scenarios

Automated

  • pnpm turbo run check:types check:lint check:format test --filter=live --filter=@plane/editor --filter=web --filter=space passes.
  • Editor: placeholder regression tests (packages/editor/src/extensions/__tests__/placeholder.test.ts).
  • Live: drain, Redis-readiness and Server.destroy unit tests.
  • Live: a two-server integration test, run locally with TEST_REDIS_URL (skipped when unset, so CI won't run it). It covers:
    • v2-written page binaries and titles preserved;
    • cross-server sync and Redis broadcast;
    • saves on unload;
    • title migration for pages without a title fragment;
    • server-side HTML→Yjs conversion.
  • Codec parity: v2 and v3 produce identical JSON for a corpus of real content (marks, colors, tasks, tables, mentions, images, callouts, embeds, code), and v3 reads v2 binaries identically. The one difference: the server now keeps code-block languages, as the browser always did.

Manual (full local stack: API, web, Space, live)

  • Pages, two users on the same page:
    • title and body sync both ways;
    • markdown shortcuts (headings, bold/italic/code, lists, Tab to nest, task lists);
    • slash menu → table, Tab between cells;
    • bubble menu after a drag selection, with bold, link, text color and Duplicate from the block menu;
    • @ mention and :emoji dropdowns;
    • undo;
    • close and reload: content persisted;
    • version restore with pretty-printed HTML (no blank blocks);
    • locked page is read-only;
    • PDF export through live.
  • Work item description edit, save and reload; comments with mentions; the placeholder returns after typing and deleting.
  • Create-work-item modal description: the placeholder switches on focus.
  • Stickies save formatted text.
  • Space renders a published work item's description read-only.
  • Rollback: a v2 web/live build opens pages saved by v3.

Not covered

  • Image upload (no storage credentials locally).
  • Users with different roles.
  • AI menu (CE doesn't render it).
  • Mixed v2/v3 live servers sharing Redis during a rolling deploy. Deploy web and live together.

References

  • WIKI-1268
  • Ported from makeplane/plane-ee#9883

Ports makeplane/plane-ee#9883 to the community editor and live server:
Tiptap 3.31.3, @tiptap/y-tiptap 3.0.9 and Hocuspocus 3.4.4, with no
change to stored Yjs documents or the editor schema.

- Editor: bubble menu on @tiptap/react/menus, AI menu on floating-ui
  instead of tippy.js, StarterKit's new bundled link/underline/list
  keymap/trailing node turned off, setContent on the v3 options form,
  CharacterCount/Placeholder from @tiptap/extensions.
- Document codecs: v3's @tiptap/html only works in a browser, so the
  helpers are built from one factory and a new @plane/editor/server entry
  uses the happy-dom codec; live imports from it.
- Placeholders are computed from the current view state, as in v2. v3's
  incremental placeholder state reads the previous editor state and only
  rescans touched blocks, so a comment box lost its placeholder after
  typing and deleting, and empty lines kept it after the caret left.
- Live: Redis extension on the v3 API (with Redlock on the configured DB),
  title fragment built with y-tiptap instead of @hocuspocus/transformer,
  and shutdown drains pending saves before Redis disconnects.
- Pin prosemirror-state/transform and the Tiptap menu extensions so the
  graph keeps one copy of each; dedupe linkifyjs.
- Clear the strict pre-commit lint warnings in touched files (named
  Tiptap imports, renamed shadowed variables).

Tests: placeholder regression tests in the editor, drain/Redis readiness/
shutdown unit tests and a two-server Redis integration test (v2-written
pages, cross-server sync, title migration, HTML conversion) in live.
Copilot AI balanced review requested due to automatic review settings October 23, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@makeplane

makeplane Bot commented Oct 23, 2026

Copy link
Copy Markdown

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

React Doctor found 1 new issue in 1 file · 1 warning · score 79 / 100 (Needs work) · 1 fixed · vs preview

1 warning

src/lib/drain-server.ts

  • ⚠️ L40 await inside a loop async-await-in-loop

Reviewed by React Doctor for commit 674f311. See inline comments for fixes.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ab5dd987-c167-46c5-9499-3b55076c18af
📥 Commits

Reviewing files that changed from the base of the PR and between 4906193 and 09446f0.

⛔ Files ignored due to path filters: 1
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing: 42
  • apps/live/package.json
  • apps/live/src/controllers/document.controller.ts
  • apps/live/src/extensions/database.ts
  • apps/live/src/extensions/redis.ts
  • apps/live/src/extensions/title-sync.ts
  • apps/live/src/lib/drain-server.ts
  • apps/live/src/lib/wait-for-redis.ts
  • apps/live/src/server.ts
  • apps/live/src/services/pdf-export/pdf-export.service.ts
  • apps/live/tests/integration/hocuspocus-v3.test.ts
  • apps/live/tests/lib/drain-server.test.ts
  • apps/live/tests/lib/wait-for-redis.test.ts
  • apps/live/tests/server-destroy.test.ts
  • deployments/cli/community/docker-compose.yml
  • packages/editor/package.json
  • packages/editor/src/components/menus/ai-menu.tsx
  • packages/editor/src/components/menus/bubble-menu/root.tsx
  • packages/editor/src/constants/utility.ts
  • packages/editor/src/extensions/__tests__/placeholder.test.ts
  • packages/editor/src/extensions/callout/extension-config.ts
  • packages/editor/src/extensions/code/code-block-node-view.tsx
  • packages/editor/src/extensions/core-without-props.ts
  • packages/editor/src/extensions/custom-link/extension.tsx
  • packages/editor/src/extensions/emoji/extension.ts
  • packages/editor/src/extensions/extensions.ts
  • packages/editor/src/extensions/headings-list.ts
  • packages/editor/src/extensions/mentions/extension-config.ts
  • packages/editor/src/extensions/mentions/extension.tsx
  • packages/editor/src/extensions/placeholder.ts
  • packages/editor/src/extensions/starter-kit.ts
  • packages/editor/src/extensions/text-style.ts
  • packages/editor/src/helpers/document-codecs.ts
  • packages/editor/src/helpers/editor-ref.ts
  • packages/editor/src/helpers/yjs-utils.ts
  • packages/editor/src/hooks/use-editor.ts
  • packages/editor/src/hooks/use-title-editor.ts
  • packages/editor/src/hooks/use-yjs-setup.ts
  • packages/editor/src/server.ts
  • packages/editor/src/types/editor.ts
  • packages/editor/tsdown.config.ts
  • packages/editor/vitest.config.ts
  • pnpm-workspace.yaml

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

Walkthrough

The editor package adds server-side document codecs and updates its Tiptap integrations. The live service updates collaboration dependencies, Redis coordination, and shutdown handling. Tests cover document conversion, cross-server collaboration, Redis readiness, and bounded shutdown.

Changes: Editor and Live Collaboration

Layer / File(s) Summary
Tiptap integration and editor behavior
pnpm-workspace.yaml, packages/editor/package.json, packages/editor/src/components/menus/*, packages/editor/src/constants/utility.ts, packages/editor/src/extensions/*, packages/editor/src/helpers/editor-ref.ts, packages/editor/src/hooks/*, packages/editor/src/types/editor.ts, packages/editor/vitest.config.ts
Dependencies and editor integrations are updated for Tiptap 3. Menu positioning, bubble-menu visibility, placeholder decorations, extension configuration, editor helpers, and editor types change. Tests cover placeholder behavior.
Shared document codecs
packages/editor/src/helpers/document-codecs.ts, packages/editor/src/helpers/yjs-utils.ts, packages/editor/src/server.ts, packages/editor/tsdown.config.ts, apps/live/src/controllers/document.controller.ts, apps/live/src/extensions/database.ts, apps/live/src/extensions/title-sync.ts, apps/live/src/services/pdf-export/pdf-export.service.ts
The editor package adds reusable HTML, ProseMirror JSON, and Yjs conversion helpers and a server entry point. Live-service imports use that entry point, and title migration uses the shared schema to create Yjs content.
Redis and Hocuspocus coordination
pnpm-workspace.yaml, apps/live/package.json, apps/live/src/extensions/redis.ts, apps/live/src/lib/wait-for-redis.ts, apps/live/tests/integration/hocuspocus-v3.test.ts, apps/live/tests/lib/wait-for-redis.test.ts
Hocuspocus dependencies move to version 3. The Redis extension waits for subscriber readiness and uses promise-based subscription methods and document broadcasts. Integration tests cover cross-server edits, title updates, and HTML-only pages.
Bounded collaboration shutdown
apps/live/src/lib/drain-server.ts, apps/live/src/server.ts, apps/live/tests/lib/drain-server.test.ts, apps/live/tests/server-destroy.test.ts, deployments/cli/community/docker-compose.yml
The server drains document saves and unloads under a shared deadline, keeps Redis connected through the drain, and disconnects Redis in a finally block. Tests cover timeout and failure behavior. The live service receives a 30-second stop grace period.

Priority: Not assessed

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant Server
  participant HTTPServer
  participant Hocuspocus
  participant Redis
  Server->>HTTPServer: Start HTTP closure
  Server->>Hocuspocus: Close collaboration connections
  par Wait for HTTP closure
    Server->>HTTPServer: Await close result
  and Drain collaboration
    Server->>Hocuspocus: Flush saves and unload documents
    Hocuspocus-->>Server: Drain result
  end
  Server->>Redis: Disconnect after drain completes
Loading

Possibly related PRs

  • makeplane/plane#10011: Updates the Tiptap catalog version that this pull request moves to Tiptap 3.31.3.
Merge Risk: Moderate · up to 674f3

Graceful shutdown can lose pending page persistence when draining exceeds the deadline; cancellation and settlement should be fixed before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 38 files. (4 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description is complete and follows the repository template. It explains the upgrade, categorizes the change, documents tests and manual scenarios, identifies coverage gaps, and includes reference…
Title check Passed The title clearly and concisely identifies the primary change: upgrading Tiptap and Hocuspocus to version 3.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is complete and follows the repository template. It explains the upgrade, categorizes the change, documents tests and manual scenarios, identifies coverage gaps, and includes references.

Full details: Docstring Coverage

Explanation

Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 38 files. (4 skipped: 4 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

Comment thread apps/live/src/lib/drain-server.ts Resolved
@saivallampati
saivallampati merged commit b4b48c9 into preview Oct 26, 2026
12 of 13 checks passed
@saivallampati
saivallampati deleted the chore/WIKI-1268-tiptap-hocuspocus-v3 branch October 26, 2026 13:11
@CLAassistant

CLAassistant commented Oct 26, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

nettnikl pushed a commit to nettnikl/hangar that referenced this pull request Dec 1, 2026
Converge the editor and live with upstream makeplane/plane v1.5.0
(b4b48c9, 8e07d40, 9cefae8).

Backport of upstream makeplane/plane b4b48c9 (makeplane#10101), 8e07d40
(makeplane#10121) and 9cefae8 (makeplane#10267), with the happy-dom 21.0.4 pin of
b98e1de (makeplane#10144): Tiptap 3.31.3, @tiptap/y-tiptap 3.0.9, Hocuspocus
3.4.4, Redlock and happy-dom; tippy.js, y-prosemirror and
@hocuspocus/transformer are gone. The document codecs come from one
factory, with a new @plane/editor/server entry on happy-dom that live
imports. This closes GHSA-cp6q-959q-f8rh on @tiptap/core.

Adapted:
- The shared codecs keep normalizeDocumentJSON on both the browser and
  the server entry.
- Paste parsing stays on parseInertHTML; prosemirror.css is now copied
  from the 3.31.3 core style (injectCSS stays off) and loses the tippy
  rule.
- live's onAuthenticate is now upstream's: Hocuspocus 3 names the
  per-socket config connectionConfig, so the guest read-only flag lands
  there. The fork's secret-key middleware on the document controller,
  the PDF asset fetch guard and the Compose live service stay.
- The delete plugin takes ySyncPluginKey from @tiptap/y-tiptap, so it
  still ignores remote collaborator changes; markdown paste reads
  tiptap-markdown's runtime parser through a local type, which the typed
  v3 storage leaves out; the callout keeps stringToEmoji.
- The editor's security suites keep running without a DOM; upstream's
  hook and placeholder tests run in a separate happy-dom vitest project.
- Title saves stay with the editing client connection's credential, so
  upstream's Redis integration test renames the title from a client
  rather than from a server-side direct connection.
- The browser codecs' @tiptap/html DOMParser call is recorded as a
  reviewed Trusted Types sink in the web and space inventories.
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.

4 participants