Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PRO]: Unique id leads to "multiple versions of prosemirror-model were loaded" issues in testing. #6171

Open
1 task done
reinvanimschoot opened this issue Mar 12, 2025 · 0 comments
Labels
Category: Pro The issue or pull request is related to the pro packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@reinvanimschoot
Copy link

Affected Packages

extension-unique-id

Version(s)

2.17.5

Description of the Bug

I am trying to test my editor environment using vitest. However, when I load the editor I am getting the following error:

RangeError: Can not convert <"This is a title"> to a Fragment (looks like multiple versions of prosemirror-model were loaded)
 ❯ Function.from node_modules/prosemirror-model/dist/index.js:354:15
 ❯ NodeType.create node_modules/prosemirror-model/dist/index.js:2180:66
 ❯ node_modules/@tiptap-pro/extension-unique-id/dist/tiptap-extension-unique-id.cjs.js:1:3173

 ❯ Fragment.forEach node_modules/prosemirror-model/dist/index.js:250:13
 ❯ o node_modules/@tiptap-pro/extension-unique-id/dist/tiptap-extension-unique-id.cjs.js:1:3042
 ❯ Plugin.transformPasted node_modules/@tiptap-pro/extension-unique-id/dist/tiptap-extension-unique-id.cjs.js:1:3281
 ❯ node_modules/prosemirror-view/dist/index.js:2876:53
 ❯ EditorView.someProp node_modules/prosemirror-view/dist/index.js:5508:50
 ❯ parseFromClipboard node_modules/prosemirror-view/dist/index.js:2876:10
 ❯ doPaste node_modules/prosemirror-view/dist/index.js:3637:17

Now, I saw the other issues on this repo that encountered the same error and I tried everything they suggested:

  • Adding a prosemirror-model version to resolutions
  • Removing and reinstalling node_modules and yarn.lock
  • Performing deduplication

But nothing works.

I then realised that when I do yarn why prosemirror-model, I get:

=> Found "[email protected]"
info Has been hoisted to "prosemirror-model"
info Reasons this module exists
   - Specified in "dependencies"
   - Hoisted from "@tiptap#pm#prosemirror-model"
   - Hoisted from "@tiptap#pm#prosemirror-commands#prosemirror-model"
   - Hoisted from "@tiptap#pm#prosemirror-gapcursor#prosemirror-model"
   - Hoisted from "@tiptap#pm#prosemirror-schema-list#prosemirror-model"
   - Hoisted from "@tiptap#pm#prosemirror-state#prosemirror-model"
   - Hoisted from "@tiptap#pm#prosemirror-schema-basic#prosemirror-model"
   - Hoisted from "@tiptap#pm#prosemirror-markdown#prosemirror-model"
   - Hoisted from "@tiptap#pm#prosemirror-view#prosemirror-model"
   - Hoisted from "@tiptap#pm#prosemirror-transform#prosemirror-model"
   - Hoisted from "@tiptap#pm#prosemirror-tables#prosemirror-model"
info Disk size without dependencies: "568KB"
info Disk size with unique dependencies: "608KB"
info Disk size with transitive dependencies: "608KB"
info Number of shared dependencies: 1
✨  Done in 0.34s.

which means no real duplication is taking place.

I also realised then, that when I remove @tiptap-pro/extension-unique-id from the extensions being loaded, everything seems to work fine.

So even though no duplication is taking place, the unique-id extension creates a situation where multiple versions of prosemirror-model are loaded.

Is there any way to fix this? I can write tests at the moment but no tests that check for correct handling of unique ids.

Browser Used

Chrome

Code Example (Preferred)

No response

Expected Behavior

That no errors are occurring when I run my editor test suite.

Additional Context (Optional)

No response

Dependency Updates

  • Yes, I've updated all my dependencies.
@reinvanimschoot reinvanimschoot added Category: Pro The issue or pull request is related to the pro packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Mar 12, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Tiptap: Issues Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Pro The issue or pull request is related to the pro packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
Status: Needs Triage
Development

No branches or pull requests

1 participant