This repository was archived by the owner on Feb 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +1
-11
lines changed Expand file tree Collapse file tree 1 file changed +1
-11
lines changed Original file line number Diff line number Diff line change 11import { createElement , useRef , useEffect , useState } from "react" ;
2- import { unmountComponentAtNode } from "react-dom" ;
32import viewer , { WebViewerInstance } from "@pdftron/webviewer" ;
43import 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 ] ) ;
You can’t perform that action at this time.
0 commit comments