From 6e6c4f7fd6b36cae11b9dc5089e672f457d5944f Mon Sep 17 00:00:00 2001
From: Sam Wilkins <samwilkins333@gmail.com>
Date: Fri, 13 Dec 2019 17:04:23 -0500
Subject: added re-write check to constructor

---
 src/client/views/pdf/PDFViewer.tsx | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

(limited to 'src/client/views/pdf/PDFViewer.tsx')

diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 450add208..648522cd9 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -121,11 +121,8 @@ export class PDFViewer extends DocAnnotatableComponent<IViewerProps, PdfDocument
         return this._annotations.filter(anno => this._script.run({ this: anno }, console.log, true).result);
     }
 
-    _lastSearch: string = "";
-    componentDidMount = async () => {
-        !this.props.Document.lockedTransform && (this.props.Document.lockedTransform = true);
-        // change the address to be the file address of the PNG version of each page
-        // file address of the pdf
+    constructor(props: any) {
+        super(props);
         const backup = "oldPath";
         const { url, Document } = this.props;
         const pathCorrectionTest = /upload\_[a-z0-9]{32}.(.*)/g;
@@ -147,6 +144,13 @@ export class PDFViewer extends DocAnnotatableComponent<IViewerProps, PdfDocument
         } else {
             console.log("Outer matches was null!");
         }
+    }
+
+    _lastSearch: string = "";
+    componentDidMount = async () => {
+        !this.props.Document.lockedTransform && (this.props.Document.lockedTransform = true);
+        // change the address to be the file address of the PNG version of each page
+        // file address of the pdf
         const path = Utils.prepend(`/thumbnail${this.props.url.substring("files/pdfs/".length, this.props.url.length - ".pdf".length)}-${(this.Document.curPage || 1)}.png`);
         this._coverPath = JSON.parse(await rp.get(path));
         runInAction(() => this._showWaiting = this._showCover = true);
-- 
cgit v1.2.3-70-g09d2

