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]: Running command inside catch block of try/catch throws mismatched transaction error #4692

Open
1 of 2 tasks
Nantris opened this issue Dec 13, 2023 · 2 comments
Open
1 of 2 tasks
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@Nantris
Copy link
Contributor

Nantris commented Dec 13, 2023

Which packages did you experience the bug in?

core

What Tiptap version are you using?

2.1.13

What’s the bug you are facing?

This occurs even if you do editor.commands instead of commands. Usually using editor.commands is enough to fix it in edge cases, but not in this case.

What browser are you using?

Chrome

Code example

No response

What did you expect to happen?

try/catch

Anything to add? (optional)

I tried commands.first but it stops if the first command throws an error so it's not suitable either.

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. 💖
@Nantris Nantris added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Dec 13, 2023
@github-project-automation github-project-automation bot moved this to Triage open in Tiptap Dec 13, 2023
@dcourv
Copy link

dcourv commented Dec 19, 2023

I couldn't reproduce this. Could you provide a concrete example/code sample?

@Nantris
Copy link
Contributor Author

Nantris commented Dec 19, 2023

Thanks for trying @dcourv. I just gave this a try and apparently it's not very easy to reproduce. Unfortunately the only example I have is some code we can't share publicly.

The only thing I can share is the initial error that we catch. It seems like the initial error must be pretty specific to cause commands run inside of catch to complain about mismatched transactions:

TypeError: Cannot read properties of undefined (reading 'nodeSize')
    at ResolvedPos.after (index.js:898:1)
    at lift (index.js:996:1)
    at Transaction.lift (index.js:1960:1)

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. Type: Bug The issue or pullrequest is related to a bug
Projects
No open projects
Status: Triage open
Development

No branches or pull requests

4 participants