pqina / vue-filepond

🔌 A handy FilePond adapter component for Vue
https://pqina.nl/filepond
MIT License
1.92k stars 128 forks source link

Uncaught TypeError: Cannot read property 'file' of null #198

Closed nh-mdev closed 3 years ago

nh-mdev commented 3 years ago

Describe the bug Using vue-filepond with the pdf preview plugin, sometimes the stacktraced error occurs on route change.

To Reproduce 1) Uploading an image 2) Waiting for it to succeed 3) Navigating away from the current route 4) Going back to upload view 5) Remove current image 6) Upload new image 7) Navigate away from current route

Expected behavior No console TypeError.

Stacktraces

Uncaught TypeError: Cannot read property 'file' of null
    at filepond-plugin-pdf-preview.js:181
    at filepond.js:1445
    at filepond.js:1096
    at Array.forEach (<anonymous>)
    at Object._write (filepond.js:1095)
    at filepond.js:1125
    at Array.forEach (<anonymous>)
    at Object._write (filepond.js:1123)
    at filepond.js:1125
    at Array.forEach (<anonymous>)

Information about your project: Windows 10 Google Chrome - Version 89.0.4389.90 (64-Bit)

"filepond": "^4.21.1"
"filepond-plugin-file-encode": "^2.1.9"
"filepond-plugin-image-preview": "^4.6.4"
"filepond-plugin-file-validate-type": "^1.2.6"
"filepond-plugin-image-transform": "^3.7.6"
"filepond-plugin-pdf-preview": "^1.0.2"
"filepond-plugin-file-validate-size": "^2.2.4"
"vue-filepond": "^6.0.3"

Additional context I tried "resolving/catching" this error in the beforeDestroy() life-cycle hook of the component holding vue-filepond, but the this.$refs is already undefined at that point.

rikschennink commented 3 years ago

I think you need to move this to the pdf-preview plugin repo.