This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 089b2e2c289 UI: Preserve Grid limit and filters when redirecting after
manual Dag trigger (#66717)
089b2e2c289 is described below
commit 089b2e2c289fb5392f5f721390d0a48629aee724
Author: Yuseok Jo <[email protected]>
AuthorDate: Wed May 13 23:32:59 2026 +0900
UI: Preserve Grid limit and filters when redirecting after manual Dag
trigger (#66717)
* UI: Preserve Grid limit and filters when redirecting after manual Dag
trigger
* UI: Drop Grid date window when redirecting after manual Dag trigger
---
.../src/airflow/ui/src/queries/useTrigger.ts | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/airflow-core/src/airflow/ui/src/queries/useTrigger.ts
b/airflow-core/src/airflow/ui/src/queries/useTrigger.ts
index b421810597a..d96fbf45cd7 100644
--- a/airflow-core/src/airflow/ui/src/queries/useTrigger.ts
+++ b/airflow-core/src/airflow/ui/src/queries/useTrigger.ts
@@ -19,12 +19,13 @@
import { useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
import { useTranslation } from "react-i18next";
-import { useNavigate, useParams } from "react-router-dom";
+import { useLocation, useNavigate, useParams } from "react-router-dom";
import { useDagRunServiceTriggerDagRun, useDagServiceGetDagsUiKey } from
"openapi/queries";
import type { TriggerDagRunResponse } from "openapi/requests/types.gen";
import type { DagRunTriggerParams } from "src/components/TriggerDag/types";
import { toaster } from "src/components/ui";
+import { SearchParamsKeys } from "src/constants/searchParams";
import { gridQueryKeys } from "src/queries/gridViewQueryKeys";
import { createErrorToaster } from "src/utils";
@@ -33,6 +34,7 @@ export const useTrigger = ({ dagId, onSuccessConfirm }: {
dagId: string; onSucce
const [error, setError] = useState<unknown>(undefined);
const { t: translate } = useTranslation("components");
const navigate = useNavigate();
+ const location = useLocation();
const { dagId: selectedDagId } = useParams();
const onSuccess = async (dagRun: TriggerDagRunResponse) => {
@@ -48,9 +50,23 @@ export const useTrigger = ({ dagId, onSuccessConfirm }: {
dagId: string; onSucce
});
onSuccessConfirm();
- // Only redirect if we're already on the dag page
+ // Only redirect if we're already on the dag page.
+ // Preserve search params so layout state (Grid limit, filters) survives
the navigation,
+ // but drop the Grid date window — carrying an older ceiling forward would
hide the
+ // newly triggered run, which sits at the current time.
if (selectedDagId === dagRun.dag_id) {
- void
Promise.resolve(navigate(`/dags/${dagRun.dag_id}/runs/${dagRun.dag_run_id}`));
+ const params = new URLSearchParams(location.search);
+
+ params.delete(SearchParamsKeys.RUN_AFTER_LTE);
+ params.delete(SearchParamsKeys.RUN_AFTER_GTE);
+ const search = params.toString();
+
+ void Promise.resolve(
+ navigate({
+ pathname: `/dags/${dagRun.dag_id}/runs/${dagRun.dag_run_id}`,
+ search: search === "" ? "" : `?${search}`,
+ }),
+ );
}
};