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

[Bug]: With prosemirror-view 1.31.0 on doing a toggleHeading command with top level NodeView, something breaks, and getPos throws an exception #3999

Open
1 of 2 tasks
segevfiner opened this issue Apr 30, 2023 · 3 comments
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Triage: Open A new issue or pullrequest that requires triage (added by default) Type: Bug The issue or pullrequest is related to a bug

Comments

@segevfiner
Copy link
Contributor

segevfiner commented Apr 30, 2023

Which packages did you experience the bug in?

core, vue-3

What Tiptap version are you using?

2.0.3

What’s the bug you are facing?

With prosemirror-view 1.31.0, when doing a toggleHeading command with a top level NodeView of some kind, the call to getPos from the NodeView will throw an exception:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'size')
    at NodeViewDesc.posBeforeChild (index.js:714:24)
    at VueNodeView.getPos (index.js:1204:39)
    at Proxy.getPos (VueNodeViewRenderer.ts:82:26)
    at ParagraphView.vue:17:12
    at Proxy.renderFnWithContext (runtime-core.esm-bundler.js:868:19)
    at Proxy.render (NodeViewWrapper.ts:26:30)
    at renderComponentRoot (runtime-core.esm-bundler.js:914:44)
    at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5720:34)
    at ReactiveEffect.run (reactivity.esm-bundler.js:190:25)
    at instance.update (runtime-core.esm-bundler.js:5763:56)

This seems to be because the descObj in VueNodeView is no longer in the children of its parent when getPos is called i this situation. This might be related to this change in prosemirror-view:

Improve performance of changing a parent node (by type or attributes) without modifying its children by reusing the DOM of the child nodes.

What browser are you using?

Chrome

Code example

https://codesandbox.io/p/sandbox/tiptap-paragraph-view-hnsd45

What did you expect to happen?

For it to work.

Anything to add? (optional)

This doesn't happen with prosemirror-view 1.30.2.

Recording 2023-04-30 at 18 13 22

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. 💖
@segevfiner segevfiner added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Triage: Open A new issue or pullrequest that requires triage (added by default) Type: Bug The issue or pullrequest is related to a bug labels Apr 30, 2023
@segevfiner segevfiner changed the title [Bug]: With prosemirror-view 1.31.0 on doing a toggleHeading command with top level NodeView, something breaks and getPos throws an exception [Bug]: With prosemirror-view 1.31.0 on doing a toggleHeading command with top level NodeView, something breaks, and getPos throws an exception May 2, 2023
@tarun-29
Copy link

hey i am facing exact same issue while working with tables i am merging cells and after merging cells i am copying that new merged table and pasting it again in editor and it's showing me the same error below are the screenshots, this is happening because of update attributes in node any help related to this will be very helpful

Screenshot 2023-08-29 at 12 51 34 AM Screenshot 2023-08-29 at 12 52 28 AM

@tarun-29
Copy link

I am using this prosemirror-view version
Screenshot 2023-08-29 at 12 53 19 AM

@corbinkems
Copy link

corbinkems commented Dec 21, 2023

I'm getting the same bug with lists. If you copy and paste a list with two or more react node views in them, it throws an error

In my example below, the call to getPos() that throws the error is in ReactNode.tsx

https://codesandbox.io/p/sandbox/tiptap-getpos-bug-833c66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Triage: Open A new issue or pullrequest that requires triage (added by default) Type: Bug The issue or pullrequest is related to a bug
Projects
Status: Triage open
Development

No branches or pull requests

5 participants