tiptap: Cannot read properties of undefined (reading 'localsInner') at "prosemirror-view": "^1.30.2"

What’s the bug you are facing?

update “prosemirror-view” to “1.30.2”, Tiptap version 2.0.0-beta.220, iget e error

index.js:3964 Uncaught TypeError: Cannot read properties of undefined (reading 'localsInner')
    at DecorationGroup.locals (index.js:3964:42)
    at iterDeco (index.js:1898:23)
    at NodeViewDesc.updateChildren (index.js:1257:9)
    at new NodeViewDesc (index.js:1162:18)
    at docViewDesc (index.js:1389:12)
    at EditorView.updateStateInner (index.js:5047:36)
    at EditorView.updateState (index.js:4998:14)
    at Editor.createView (Editor.ts:281:15)
    at new Editor (Editor.ts:84:10)

Which browser was this experienced in? Are any special extensions installed?

chrome 111.0.5563.65

How can we reproduce the bug on our side?

update “prosemirror-view” to “1.30.2”

Can you provide a CodeSandbox?

No response

What did you expect to happen?

use new version prosemirror

Anything to add? (optional)

No response

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 12
  • Comments: 16 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Yeah I just want to add a comment here, that even though you have no duplicate packages installed, apparently Rollup or Vite might still include prosemirror into your js bundle. It’s a bit absurd as I have set all devDeps and deps as external so nothing should get included. Yet it does.

This seemed to have done the trick:

    rollupOptions: {
      external: [
        '@tiptap/pm/model',
        '@tiptap/pm/state',
        '@tiptap/pm/view',
        'react',
        'react/jsx-runtime',
        'react-dom',
        ...Object.keys(pkg.devDependencies || {}),
        ...Object.keys(pkg.dependencies || {})
      ]
    },

EDIT: Now I figured it out, @tiptap/pm isn’t being externalized because the import paths eg @tiptap/pm/model don’t map to Object.keys(pkg.dependencies || {}) directly. Maybe there’s a wildcard pattern you can use but I wrote them down manually.

This most likely has to do with the use of different ProseMirror package versions.

Please do the following:

  • always use @tiptap/pm if you want to use ProseMirror functions
  • update tiptap packages to version 2.2.1, update tiptap-pro packages to version 2.6.4
  • clean up the lock file if necessary

If there are still problems, please check whether different versions of ProseMirror packages are registered somewhere, e.g. with npm ls prosemirror-view.

I get this error when trying to use PluginKey, either via @tiptap/pm or directly from prosemirror-state.

I’m getting this in 2.1.7 specifically when I have the following plugins enabled:

Focus or Placeholder + CodeBlockLowlight

tried to reproduce in stackblitz but was unsuccessful.

I just hit this myself when going from tiptap libraries 2.1.12 -> 2.2.1.

I followed the advice to lock the prosemirror-view version since I had multiple. (I have starter-kit locked because we also use hocuspocus libraries and that version is ^2.1.12 which leads to other issues.)

"resolutions": {
    "@tiptap/starter-kit": "2.2.1",
    "prosemirror-view": "1.32.7",
  },

This seemed to resolve my problem.

Faced the same problem recently. The trigger was the addition of the tiptap-annotation-magic alongside the placeholder extension. They both use decorations so I’m guessing there’s something in the way they interact that causes the issue.

I tried playing around a bit with the versions of each library and prosemirror-view but that didn’t seem to help.

any update on this? I noticed this error happens whenever I enable the collaboration cursor extension in my editor