yimingpeng commented on code in PR #56163:
URL: https://github.com/apache/airflow/pull/56163#discussion_r2393707072


##########
airflow-core/src/airflow/ui/src/pages/Dashboard/PoolSummary/PoolSummary.tsx:
##########
@@ -17,25 +17,42 @@
  * under the License.
  */
 import { Box, Heading, Flex, Skeleton, Link } from "@chakra-ui/react";
+import { useState } from "react";
 import { useTranslation } from "react-i18next";
 import { BiTargetLock } from "react-icons/bi";
 import { Link as RouterLink } from "react-router-dom";
 
 import { useAuthLinksServiceGetAuthMenus } from "openapi/queries";
 import { usePoolServiceGetPools } from "openapi/queries/queries";
+import type { ExpandedApiError } from "src/components/ErrorAlert";
+import { ErrorAlert } from "src/components/ErrorAlert";
 import { PoolBar } from "src/components/PoolBar";
 import { useAutoRefresh } from "src/utils";
 import { type Slots, slotKeys } from "src/utils/slots";
 
 export const PoolSummary = () => {
   const { t: translate } = useTranslation("dashboard");
   const refetchInterval = useAutoRefresh({});
-  const { data, isLoading } = usePoolServiceGetPools(undefined, undefined, {
-    refetchInterval,
-  });
+
   const { data: authLinks } = useAuthLinksServiceGetAuthMenus();
   const hasPoolsAccess = authLinks?.authorized_menu_items.includes("Pools");
 
+  const [hasPermissionError, setHasPermissionError] = useState(false);
+
+  const { data, error, isLoading } = usePoolServiceGetPools(undefined, 
undefined, {
+    enabled: !hasPermissionError,
+    refetchInterval: hasPermissionError ? false : refetchInterval,
+    retry: (failureCount, retryError) => {
+      if (Boolean(retryError) && (retryError as ExpandedApiError).status === 
403) {
+        setHasPermissionError(true);
+
+        return false;
+      }
+
+      return failureCount < 3;
+    },
+  });
+

Review Comment:
   Thanks for review, yep, you're right, that's a better approach.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to