From f7e7e337f8a1ad4e72ccff61d88717e84c06752d Mon Sep 17 00:00:00 2001 From: Jean-Marc Millet Date: Tue, 3 Sep 2024 15:59:51 +0200 Subject: [PATCH] add a parameter to query options to update the ref use to ensure Accesstoken is valid and then use in queryFn of useQuery. The ref was only update when the token change, and was not update when the selected bucket changes causing the query to be potentially called for the wrong bucket --- src/react/ui-elements/EmptyBucket/index.tsx | 5 +++-- src/react/utils/IAMhooks.ts | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/react/ui-elements/EmptyBucket/index.tsx b/src/react/ui-elements/EmptyBucket/index.tsx index d1ec3892f..c5d756f99 100644 --- a/src/react/ui-elements/EmptyBucket/index.tsx +++ b/src/react/ui-elements/EmptyBucket/index.tsx @@ -147,6 +147,7 @@ export const EmptyBucket = ({ bucketName }: EmptyBucketProps) => { refetchOnWindowFocus: false, refetchOnMount: true, refetchOnReconnect: false, + additionalDepsToUpdateQueryFn: [bucketName], }, (data) => createDeleteObjectsData(data.DeleteMarkers, data.Versions), ); @@ -209,12 +210,12 @@ export const EmptyBucket = ({ bucketName }: EmptyBucketProps) => { } overlayStyle={{ width: '9rem', - display: isBucketEmpty ? 'none' : undefined, + display: isBucketEmpty ? undefined : 'none', }} >