-
-
Notifications
You must be signed in to change notification settings - Fork 557
Uncaught RangeError: Position -1 out of range when creating a new editor instance #1145
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
Comments
Hey @matthewlipski @YousefED can anyone give me some guidance on this bug ??? |
I saw the same error with NextJS 15. Once I added |
Hey @trival Thanks for comment but I'm using react. Do you know what same can be done in react ? |
I am not sure. It seems the error is raised somewhere in ProseMirror, because some event is not propagated correctly. In my application, NextJS 14 was working just fine. The error started after updating to Next 15 and dissappeared after the configuration change. Apparently the configuration is somehow related to StrictMode. Maybe you or some of your downstream dependencies are using it? Other than that I don't have more clues... |
Also from StrictMode Docs:
Maybe your code does something like that? |
Yes there is a re-render when switches into editing mode
I think I should look into re-rendering part. |
Hey @trival Thanks for suggesting me the solution. Yes you were correct the thing was the editor was re-rendered multiple times and that caused this issue. Thanks for helping me out and I would like to connect with you on other platforms and lets be friend. Already followed you on X. Once again thank you mate. |
Description:
I encountered an Uncaught RangeError: Position -1 out of range error while creating a new editor instance in my project. This happens when a new editor is initialized in "editing mode." Below is the stack trace:
Steps to Reproduce:
Create a new editor instance using the following code:
Expected Behavior:
The editor should initialize properly and allow user interaction without any errors.
Actual Behavior:
The error Position -1 out of range occurs when trying to resolve a position within the document, possibly related to mouse input handling.
It works normal after a re-render of component but on initialization it throws a error.
Please free to give your suggestion on this if I'm doing something wrong or so.
The text was updated successfully, but these errors were encountered: