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',
}}
>
}
- disabled={!isBucketEmpty}
+ disabled={isBucketEmpty}
variant="danger"
onClick={handleEmptyClick}
label={EMPTY_CONFIRMATION_MODAL_TITLE}
diff --git a/src/react/utils/IAMhooks.ts b/src/react/utils/IAMhooks.ts
index 1fe4fabbd..d0e9918e7 100644
--- a/src/react/utils/IAMhooks.ts
+++ b/src/react/utils/IAMhooks.ts
@@ -53,7 +53,7 @@ export const useAwsPaginatedEntities = <
ENTITY,
TError,
MARKER_TYPE
- >,
+ > & { additionalDepsToUpdateQueryFn?: unknown[] },
getEntitiesFromResult: (data: API_RESPONSE) => ENTITY[],
preventNextPagesRetrieval = false,
): AWS_PAGINATED_ENTITIES => {
@@ -96,7 +96,7 @@ export const useAwsPaginatedEntities = <
>();
useEffect(() => {
ref.current = reactQueryOptions?.queryFn;
- }, [token]);
+ }, [token, ...(reactQueryOptions.additionalDepsToUpdateQueryFn || [])]);
//--------------------------------------------------------------------
const {
@@ -116,16 +116,19 @@ export const useAwsPaginatedEntities = <
return ref.current?.(ctx, ctx.pageParam);
},
});
+
const pageIndex = data?.pageParams?.length || 0;
const entities =
data &&
data.pages &&
data.pages.flatMap((page) => getEntitiesFromResult(page));
+
useMemo(() => {
if (pageIndex === 0 || (pageIndex === 1 && internalStatus === 'success')) {
setFirstPageStatus(internalStatus);
}
}, [internalStatus, pageIndex]);
+
useMemo(() => {
if (
internalStatus === 'idle' ||
@@ -165,11 +168,13 @@ export const useAwsPaginatedEntities = <
firstPageStatus,
} as AWS_PAGINATED_ENTITIES;
};
+
type AccessKeyObject = {
accessKey: string;
createdOn: string;
status: string;
};
+
export const useAccessKeyOutdatedStatus = (
accessKeyObject: AccessKeyObject,
) => {