18315: Only limit the fetchData() call on PDH changes.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 15 Feb 2022 19:24:35 +0000 (16:24 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 15 Feb 2022 19:24:35 +0000 (16:24 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

src/components/collection-panel-files/collection-panel-files.tsx

index 459d9d2082349f79c78ef592861395e34baf337a..1ee6df304378f401cdc6b502363dd01c22dd4348 100644 (file)
@@ -278,13 +278,12 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
         }
     }, [rightKey]); // eslint-disable-line react-hooks/exhaustive-deps
 
+    const currentPDH = (collectionPanel.item || {}).portableDataHash;
     React.useEffect(() => {
-        const hash = (collectionPanel.item || {}).portableDataHash;
-
-        if (hash && collectionAutofetchEnabled) {
+        if (currentPDH) {
             fetchData([leftKey, rightKey], true);
         }
-    }, [(collectionPanel.item || {}).portableDataHash]); // eslint-disable-line react-hooks/exhaustive-deps
+    }, [currentPDH]); // eslint-disable-line react-hooks/exhaustive-deps
 
     React.useEffect(() => {
         if (rightData) {