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


##########
airflow-core/src/airflow/ui/src/pages/Dashboard/PoolSummary/PoolSummary.tsx:
##########
@@ -23,19 +23,30 @@ 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 { 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({ checkPendingRuns: true });
-  const { data, isLoading } = usePoolServiceGetPools(undefined, undefined, {
-    refetchInterval,
-  });
+
   const { data: authLinks } = useAuthLinksServiceGetAuthMenus();
   const hasPoolsAccess = authLinks?.authorized_menu_items.includes("Pools");
 
+  const { data, error, isLoading } = usePoolServiceGetPools(undefined, 
undefined, {
+    refetchInterval: (query) => {
+      const apiError = query.state.error as ExpandedApiError | null;
+
+      return apiError?.status === 403 ? false : refetchInterval;
+    },
+  });
+
+  if (Boolean(error) && (error as ExpandedApiError).status === 403) {
+    return undefined;
+  }
+

Review Comment:
   The important part for type checking issues is:
   ```
   usePoolServiceGetPools<
            PoolServiceGetPoolsDefaultResponse,
            AxiosError<HTTPExceptionResponse>
          >
   ```
   
   This should have no impact at run-time and you can keep the original version 
of your code or iteratively check why there is a difference. 
   
   The expected behavior I think is to see 'nothing' at all related to the 
PoolSummary component when permissions are not right.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to