cyntler / cyntler/react-doc-viewer

DocViewer loosing content when scrolling

Open
#208 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
481
Forks
147
PR merge metrics
No merged PRs in 30d

Description

I'm using this library to display different kinds of documents (pdf, ppt etc.).

For the most part it's working fine, yet if you scroll up and down for a bit (inside a doc in the viewer that is), the doc's content disappears without any error indicating faulty data being passed or anything similar. This is not exclusive to any file type and every file is initially displayed correctly (hence the files do not seem to be corrupted).

Inside my codebase the file object array holding the file information (uri, fileName etc.) seems to be correct at the time the content disappears. Same goes for the currentFile prop that is passed to the DocViewer and the rest of the config.

I'm having trouble determining whether this issue is caused by my own code or if it's a library bug.

For analysis I went into Document.js at @cyntler/react-doc-viewer/node_modules/react-pdf/dist/esm/Document.js & added some console logs.
Apparently the pdfState (Object with 2 keys: value & error, initially destructured as follows:
const { value: pdf, error: pdfError } = pdfState;
) looses it's value (which is then undefined) without any error being set (the error field is undefined as well). That is also probably the reason there are no console errors indicating what happened.
No pdfDispatch is called prior to this happening.

If you have any idea about this issue / any idea as to how I could have caused it with my own code, I would highly appreciate some advice.
I don't seem to be getting anywhere on my own x).

In case I gather any more useful knowledge about this or fix the issue I'll update this thread to let you know.

Thanks in advance, have a nice day!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.