Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit df25a4f

Browse files
committed
Removed additional clean up code
1 parent 4623d31 commit df25a4f

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/components/PDFViewer.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { createElement, useRef, useEffect, useState } from "react";
2-
import { unmountComponentAtNode } from "react-dom";
32
import viewer, { WebViewerInstance } from "@pdftron/webviewer";
43
import WebViewerModuleClient from "../clients/WebViewerModuleClient";
54

@@ -32,21 +31,12 @@ const PDFViewer: React.FC<InputProps> = props => {
3231
const viewerRef = useRef<HTMLDivElement>(null);
3332
const [wvInstance, setInstance] = useState<null | WebViewerInstance>(null);
3433

35-
// Perform clean-up of WV when unmounted forcibly.
34+
// Perform clean-up of WV when unmounted
3635
useEffect(() => {
37-
const topWindow = window.top;
3836
return () => {
3937
if (wvInstance) {
4038
// Disposing WV events
4139
wvInstance.UI.dispose();
42-
const element = wvInstance.UI.iframeWindow.document.getElementById("app") as Element;
43-
// Further remove React component
44-
unmountComponentAtNode(element);
45-
// This part is necessary as a page refresh is the only way everything gets cleared.
46-
// However, the page will show a reload post navigation.
47-
if (topWindow) {
48-
topWindow.location.reload();
49-
}
5040
}
5141
};
5242
}, [wvInstance]);

0 commit comments

Comments
 (0)