bbovenzi commented on code in PR #76689:
URL: https://github.com/apache/airflow/pull/76689#discussion_r4539305678
##########
airflow-core/src/airflow/ui/src/pages/DagsList/DagsList.tsx:
##########
@@ -149,7 +150,10 @@ export const DagsList = () => {
const multiTeamEnabled = Boolean(useConfig("multi_team"));
// Derived through the pill's own mapping so the query can never filter on
more than the pill shows.
- const { paused, schedulingState } =
pausedStateToQuery(pausedStateFromSearchParams(searchParams));
+ const pausedDefaultPending = usePausedDefault();
+ const pausedState =
+ pausedStateFromSearchParams(searchParams) ?? (pausedDefaultPending ?
"not_paused" : undefined);
Review Comment:
```suggestion
const pausedState = pausedStateFromSearchParams(searchParams) ??
usePausedDefault();
```
Let's not have not_paused as a raw string. Let's check against the actually
defined default
##########
airflow-core/src/airflow/ui/src/pages/DagsList/DagsFilters/DagsFilters.test.tsx:
##########
@@ -72,6 +72,27 @@ describe("Paused filter with hide_paused_dags_by_default
enabled", () => {
});
});
+ it("sends the paused default on every dags request, including the first",
async () => {
+ const urls: Array<URL> = [];
+ const onRequest = ({ request }: { request: Request }) => {
+ urls.push(new URL(request.url));
+ };
+
+ server.events.on("request:start", onRequest);
+ try {
+ render(<AppWrapper initialEntries={["/dags"]} />);
+
+ await waitFor(() =>
expect(screen.getByText("tutorial_taskflow_api_success")).toBeInTheDocument());
+ } finally {
+ server.events.removeListener("request:start", onRequest);
+ }
+
+ const dagsRequests = urls.filter((url) => url.pathname === "/ui/dags");
+
+ expect(dagsRequests.length).toBeGreaterThan(0);
Review Comment:
```suggestion
expect(dagsRequests.length).toHaveLength(1);
```
Let's actually test that it was only one request
##########
airflow-core/src/airflow/ui/src/pages/DagsList/usePausedDefault.ts:
##########
Review Comment:
Let's fix this hardcoding of false too while we're fixing this.
```ts
if (prev.has(SearchParamsKeys.PAUSED) ||
prev.has(SearchParamsKeys.SCHEDULING_STATE)) {
return prev;
}
```
--
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]