diff --git a/ui/component/fileViewer/view.jsx b/ui/component/fileViewer/view.jsx index eb0363ee9..0df34a06a 100644 --- a/ui/component/fileViewer/view.jsx +++ b/ui/component/fileViewer/view.jsx @@ -105,10 +105,10 @@ export default function FileViewer(props: Props) { setFileViewerRect(rect); } + handleResize(); + window.addEventListener('resize', handleResize); + onFullscreenChange(window, 'add', handleResize); return () => { - handleResize(); - window.addEventListener('resize', handleResize); - onFullscreenChange(window, 'add', handleResize); window.removeEventListener('resize', handleResize); onFullscreenChange(window, 'remove', handleResize); };