From 36de6cfeefa8c97692a3d4d35218ddd97e806b32 Mon Sep 17 00:00:00 2001 From: Sky Rubenstein Date: Thu, 7 Nov 2024 13:22:06 -0500 Subject: [PATCH] Fix the enumerate snapshots to get more snapshots than the first 10 --- src/components/data_search/DatasetSearchTable.jsx | 11 ++++++----- src/libs/ajax/TerraDataRepo.js | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/data_search/DatasetSearchTable.jsx b/src/components/data_search/DatasetSearchTable.jsx index 8a01cf619..097686825 100644 --- a/src/components/data_search/DatasetSearchTable.jsx +++ b/src/components/data_search/DatasetSearchTable.jsx @@ -1,8 +1,9 @@ import Tab from '@mui/material/Tab'; import Tabs from '@mui/material/Tabs'; +import useOnMount from '@mui/utils/useOnMount' import * as React from 'react'; import { Box, Button } from '@mui/material'; -import { useEffect, useState, useRef } from 'react'; +import { useEffect, useState } from 'react'; import { isEmpty } from 'lodash'; import { TerraDataRepo } from '../../libs/ajax/TerraDataRepo'; import { DatasetSearchTableDisplay } from './DatasetSearchTableDisplay'; @@ -201,12 +202,12 @@ export const DatasetSearchTable = (props) => { } }; - useEffect(() => { - if (isEmpty(filtered)) { + useOnMount(() => { + if (isEmpty(datasets)) { return; } - getExportableDatasets(filtered); - }, [filtered]); + getExportableDatasets(datasets); + }); useEffect(() => { setFiltered(datasets); diff --git a/src/libs/ajax/TerraDataRepo.js b/src/libs/ajax/TerraDataRepo.js index 4c2e74826..b147665e4 100644 --- a/src/libs/ajax/TerraDataRepo.js +++ b/src/libs/ajax/TerraDataRepo.js @@ -18,7 +18,8 @@ export const TerraDataRepo = { }; const rootTdrApiUrl = await Config.getTdrApiUrl(); const snapshotPromises = partitionedIdentifiers.map(sublist => { - const url = `${rootTdrApiUrl}/api/repository/v1/snapshots?duosDatasetIds=${sublist.join('&duosDatasetIds=')}`; + // 1000 should be safe with only 70 DUOS IDs. + const url = `${rootTdrApiUrl}/api/repository/v1/snapshots?limit=1000&duosDatasetIds=${sublist.join('&duosDatasetIds=')}`; return axios.get(url, Config.authOpts()); }); await Promise.all(snapshotPromises).then(function(responses) {