Skip to content

Uncaught (in promise) Error at PdfHighlighter.init #307

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

Open
christophhalbi opened this issue Feb 5, 2025 · 3 comments
Open

Uncaught (in promise) Error at PdfHighlighter.init #307

christophhalbi opened this issue Feb 5, 2025 · 3 comments

Comments

@christophhalbi
Copy link

From time to time I get:

Uncaught (in promise) Error: !
at PdfHighlighter.init (react-pdf-highlighter.js?v=7deb8492:2123:13)

Thrown here:

if (!this.containerNodeRef.current) {
    throw new Error("!");
}

Am I doing anything wrong?

@christophhalbi
Copy link
Author

Seems like a timing issue to me - checking containerNodeRef.current in init before ref is set in render

@israel-arvizu
Copy link

Getting this issue as well, do you know what might be causing this, maybe I'm not waiting for the component to mount?

@christophhalbi
Copy link
Author

Solution for me was to overwrite PdfHighlighter and add a little timeout to overcome the timing-issue.

https://gist.github.com/christophhalbi/40ce155e2bc326a1effafe746635a04a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants