Abhishekmishra2808 commented on code in PR #61588:
URL: https://github.com/apache/airflow/pull/61588#discussion_r2822505263
##########
airflow-core/src/airflow/ui/src/queryClient.ts:
##########
@@ -39,6 +40,31 @@ const retryFunction = (failureCount: number, error: unknown)
=> {
return failureCount < RETRY_COUNT;
};
+// Track active 403 toast to prevent duplicates when multiple mutations fail
+let active403ToastId: string | undefined;
+
+// Error handler for 403 (Forbidden) responses on user-initiated actions
+const handle403Error = (error: unknown) => {
+ // Check for 403 (Forbidden) only to avoid interfering with 401 (Auth) logic
+ // Using nullish coalescing to safely find the status regardless of error
shape
+ const status =
+ (error as { status?: number }).status ??
+ (error as { response?: { status?: number } }).response?.status;
+
+ if (status === 403) {
+ // Only show one 403 toast at a time to prevent toast spam
+ // when multiple mutations fail simultaneously
+ if (active403ToastId === undefined || !toaster.isActive(active403ToastId))
{
+ active403ToastId = toaster.create({
Review Comment:
The 403 handling is already centralized in `MutationCache`, so it applies to
all mutations returning 403, not just the case shown in the video. Other 403
errors will also display the global permission message.
This works independently but aligns with the common handler introduced in
#61560.
--
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]