Hi, thanks for the package.
I'm on version 2.7.4 of this package, upgraded from 2.7.2.
I have a bug where sporadically the PDF viewer will not work within a React application. It seems that whenever this happens, the "src" of the iframe is set to about:blank (or undefined).
I'm not quite sure where the bug is as I'm not that familiar with custom web components, but under the disconnectedCallback it seems that it's setting the url to about:blank:
|
this.iframe.src = 'about:blank' |
However it seems that connectedCallback could be called multiple times, so I am guessing that under that function connectedCallback something is incorrect.
Perhaps with:
|
viewerOptions?.set('defaultUrl', this.getFullPath(this.getAttribute('src') || DEFAULTS.src)) |
When the bug occurs I am seeing the following in the Element inspector:
<pdfjs-viewer-element src="(URL)" viewer-extra-styles="#toolbarViewerRight { display: none }" viewer-path="(URL)" locale="nl" data-sentry-element="pdfjs-viewer-element" data-sentry-component="PdfViewer" data-sentry-source-file="pdf-viewer.tsx" style="height: calc(100vh - var(--app-shell-header-height, 0px) - var(--app-shell-footer-height, 0px));"><template shadowrootmode="open">
<style>:host{width:100%;display:block;overflow:hidden}:host iframe{height:100%}</style>
<iframe frameborder="0" width="100%" loading="lazy" title="PDF viewer window"></iframe>
</template></pdfjs-viewer-element>
Note that there's no srcdoc
Hi, thanks for the package.
I'm on version 2.7.4 of this package, upgraded from 2.7.2.
I have a bug where sporadically the PDF viewer will not work within a React application. It seems that whenever this happens, the "src" of the iframe is set to
about:blank(or undefined).I'm not quite sure where the bug is as I'm not that familiar with custom web components, but under the
disconnectedCallbackit seems that it's setting the url toabout:blank:pdfjs-viewer/src/pdfjs-viewer-element.ts
Line 280 in c7f99db
However it seems that
connectedCallbackcould be called multiple times, so I am guessing that under that functionconnectedCallbacksomething is incorrect.Perhaps with:
pdfjs-viewer/src/pdfjs-viewer-element.ts
Line 202 in c7f99db
When the bug occurs I am seeing the following in the Element inspector:
Note that there's no
srcdoc