Ngx-extended-pdf-viewer: TypeError: Cannot read property 'dispatch' of null

Created on 15 Mar 2019  路  10Comments  路  Source: stephanrauh/ngx-extended-pdf-viewer

@stephanrauh , Hi
I was trying to use package, it gives me the following error:
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'dispatch' of null
**TypeError: Cannot read property 'dispatch' of

_Package some time it work but some time it not work._
pdf-error

Thanks a lot in advance,

bug

Most helpful comment

@stephanrauh I would like to become contributor for this exciting project.

All 10 comments

I'm afraid I need more details. Are you using Internet Explorer? Can you send me the code snippets of vendor.js, line 47984 (plus several lines around it)? The problem with minification is that your vendor.js looks different than my vendor.js, so the line number doesn't help me at all.

Even more important: Can you send me a reproducer? You know, the bug simply doesn't happen on my machine, so I can't fix it.

I'm Using Chrome. ngx-pdf-viewer this is my code. Please run it on local machine and use navigation button to navigate one pdf to another multiple times, so you will get that error.

Thank you for you Help.

Awesome! Currently, I've cloned your repo and I'm trying to reproduce the bug. So far, everything works like charm. Which operating system are you using?

There's an exception occurring every once in a while, but without visible problems:

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'read' of null
TypeError: Cannot read property 'read' of null
    at pump (pdf.js:15397)
    at pdf.js:15407
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
    at Object.onInvoke (core.js:16156)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:390)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:150)
    at zone.js:889
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:16147)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at resolvePromise (zone.js:831)
    at zone.js:896
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:16147)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at drainMicroTaskQueue (zone.js:601)

Oh. Looks like a problem specific to Windows. I've managed to reproduce the bug using your reproducer on Windows almost immediately.

@Dev-Akshay-Shelke Before I forget it: Thanks for providing the reproducer!

While updating your demo to version 0.9.15 (and pdf.js 2.1.266) didn't solve the bug, now I can decipher the source code. For some reason, the internal event bus of the pdf.js viewer is null. But not always. Weird.

I suspect the garbage collector runs after hiding the first PDF file. If it does, it removes a part of the data structure. Sometimes it doesn't run, and that's when everything works fine. Just a wild guess.

Adding the option [delayFirstView]="500" seems to help.

However, it would be nice to learn how to initialize the PDF viewer correctly. Maybe the bug is related to the memory leaks of #17 .

I have resolved Errors while reloading the page #26
issue using setTimeout in ngOnChanges.
Thank for working on this current issue.

@stephanrauh I would like to become contributor for this exciting project.

@Dev-Akshay-Shelke Sorry for sluggish response. Yeah, sure, I'm more than happy to invite you as a contributor! Send me an e-mail, so we can talk about how to do it (webmaster1 at beyondjava.de).

Thank You @stephanrauh For giving me opportunity, dev.[email protected]

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ravikumarbggit picture ravikumarbggit  路  10Comments

ekselys picture ekselys  路  5Comments

DHalilovic picture DHalilovic  路  6Comments

Prasanth-FrontendDeveloper picture Prasanth-FrontendDeveloper  路  7Comments

rscherer picture rscherer  路  7Comments