From: Lucas Di Pentima Date: Tue, 15 Feb 2022 19:24:35 +0000 (-0300) Subject: 18315: Only limit the fetchData() call on PDH changes. X-Git-Tag: 2.4.0~10^2~3 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/b6bcf00e089f6f14f59a031ab0139b5420df9bdd 18315: Only limit the fetchData() call on PDH changes. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx index 459d9d20..1ee6df30 100644 --- a/src/components/collection-panel-files/collection-panel-files.tsx +++ b/src/components/collection-panel-files/collection-panel-files.tsx @@ -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) {