diff --git a/apps/portal/src/components/resumes/ResumePdf.tsx b/apps/portal/src/components/resumes/ResumePdf.tsx index 4a4c3a42..8caf0cb5 100644 --- a/apps/portal/src/components/resumes/ResumePdf.tsx +++ b/apps/portal/src/components/resumes/ResumePdf.tsx @@ -24,23 +24,18 @@ export default function ResumePdf({ url }: Props) { setNumPages(pdf.numPages); }; - useEffect(() => { - const onPageResize = () => { - setComponentWidth( - document.querySelector('#pdfView')?.getBoundingClientRect().width ?? - 780, - ); - }; - - window.addEventListener('resize', onPageResize); + const onPageResize = () => { + setComponentWidth( + document.querySelector('#pdfView')?.getBoundingClientRect().width ?? 780, + ); + }; - return () => { - window.removeEventListener('resize', onPageResize); - }; - }, []); + useEffect(() => { + onPageResize(); + }, [pageWidth]); return ( -