liwenjie200543 opened a new pull request, #74011:
URL: https://github.com/apache/airflow/pull/74011
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Fix the date range filter inputs calling `onChange` on every valid
keystroke, which triggered URL search param updates and caused the editing
state to be overwritten by the synced value from the parent. This made the date
picker effectively unusable — typed values would flash or get replaced with
formatted values, in the DAG list filters and in the Jobs tab (both use the
shared `FilterBar`).
**Fix:** Keep edits local in `handleInputChange` (no `onChange` call, and no
side effect inside the state updater). The editing state commits explicitly via:
- Pressing Enter in any date/time input
- Closing the popover (clicking outside or pressing Escape)
- Clicking a date in the calendar popover (unchanged)
- Clearing a field (unchanged)
`commitEditingState()` skips the commit when inputs fail validation and
performs a cheap comparison so closing the popover without edits does not fire
`onChange` at all (the concern raised on the previous attempt). There is no
Apply button — consistent with the review consensus on #69955 — and no dead
props: `onCommit` is passed through `DateRangeFilter` → `DateRangeInputs` → all
four `DateInput`s.
closes: #69891
Supersedes the closed-as-stale #69955 (independently re-implemented; the
approach follows the review feedback left there).
---
### Test plan
- `pnpm vitest run
src/components/FilterBar/filters/DateRangeFilter.test.tsx` → 12/12 pass,
including a new regression test (progressive typing never calls `onChange` and
the input keeps the typed value) and the updated end-of-day commit test via
Enter
- Full UI suite `pnpm vitest run`: 1424/1426 pass; the 2 failures
(`queryClient.test.ts` and one load-flaky spec) reproduce identically on
unmodified `main` and are in files unrelated to this change
- `pnpm lint` (eslint + tsc) passes
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes - ZCode (GLM)
Generated-by: ZCode (GLM) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
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]