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

fix: check for undefined ref value in usePDF #73

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

Floppy012
Copy link
Contributor

Thank you for this awesome package!

For my current project I don't have the URL of a PDF at component-setup. However, I have to make the call to usePDF since it internally uses stuff that can only be used during component setup.

When providing a ref that has no initial value its value will be undefined, which leads to errors because PDFJS does not expect undefined as the getDocument parameter. This PR adds checks for undefined and only runs the processLoadingTask if the ref value is not undefined.

Through the watcher action the PDF will be loaded once the ref value has been set.

If you have any questions please tag me 😄

@TaTo30 TaTo30 merged commit 2855ea8 into TaTo30:master Dec 16, 2023
@TaTo30
Copy link
Owner

TaTo30 commented Dec 16, 2023

Good point, thanks!

@Floppy012 Floppy012 deleted the undefined-ref-value branch December 17, 2023 00:02
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

Successfully merging this pull request may close these issues.

2 participants