diff --git a/airflow-core/src/airflow/ui/src/queries/useToggleFavoriteDag.ts b/airflow-core/src/airflow/ui/src/queries/useToggleFavoriteDag.ts index d3cfaa7cf0c2d..6093177a64d59 100644 --- a/airflow-core/src/airflow/ui/src/queries/useToggleFavoriteDag.ts +++ b/airflow-core/src/airflow/ui/src/queries/useToggleFavoriteDag.ts @@ -35,10 +35,13 @@ export const useToggleFavoriteDag = (dagId: string) => { queryKey: [useDagServiceGetDagsUiKey, UseDagServiceGetDagDetailsKeyFn({ dagId }, [{ dagId }])], }); - // Invalidate the specific DAG details query for this DAG - await queryClient.invalidateQueries({ - queryKey: UseDagServiceGetDagDetailsKeyFn({ dagId }, [{ dagId }]), - }); + const queryKeys = [ + // Invalidate the specific DAG details query for this DAG and DAGs list query. + UseDagServiceGetDagDetailsKeyFn({ dagId }, [{ dagId }]), + [useDagServiceGetDagsUiKey], + ]; + + await Promise.all(queryKeys.map((key) => queryClient.invalidateQueries({ queryKey: key }))); }, [queryClient, dagId]); const favoriteMutation = useDagServiceFavoriteDag({