Skip to content

Commit

Permalink
(fix) O3-3418 service queues fails to re-fetch after delete ops (#1210)
Browse files Browse the repository at this point in the history
Co-authored-by: Brandon Istenes <[email protected]>
  • Loading branch information
PiusKariuki and brandones authored Jul 1, 2024
1 parent 2bbc81e commit e6a9ec0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/esm-service-queues-app/src/hooks/useQueueEntries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ export function useQueueEntries(searchCriteria?: QueueEntrySearchCriteria, rep:
}
if (pageData && !isValidating && !stillWaitingForMutate) {
// We've got results! Time to update the data array and move on to the next page.
if (pageData?.data?.totalCount && pageData?.data?.totalCount !== totalCount) {
if (pageData?.data?.totalCount > -1 && pageData?.data?.totalCount !== totalCount) {
setTotalCount(pageData?.data?.totalCount);
}
if (pageData?.data?.results?.length) {
if (pageData?.data?.results) {
const newData = [...data];
newData[currentPage] = pageData?.data?.results;
setData(newData);
Expand Down Expand Up @@ -154,7 +154,7 @@ export function useQueueEntries(searchCriteria?: QueueEntrySearchCriteria, rep:
return {
queueEntries,
totalCount,
isLoading: !totalCount || (totalCount && queueEntries.length < totalCount),
isLoading: totalCount === undefined || (totalCount && queueEntries.length < totalCount),
isValidating: isValidating || currentPage < data.length,
error,
mutate: mutateQueueEntries,
Expand Down

0 comments on commit e6a9ec0

Please sign in to comment.