You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "liwenjie200543 (via GitHub)" <gi...@apache.org> on 2026/10/01 06:17:18 UTC
[PR] Fix date range filter inputs committing on every keystroke [airflow]
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix date range filter inputs committing on every keystroke [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi merged PR #74011:
URL: https://github.com/apache/airflow/pull/74011
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix date range filter inputs committing on every keystroke [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on PR #74011:
URL: https://github.com/apache/airflow/pull/74011#issuecomment-6002072206
Could you please attach a video of the before/after behavior?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix date range filter inputs committing on every keystroke [airflow]
Posted by "yuseok89 (via GitHub)" <gi...@apache.org>.
yuseok89 commented on code in PR #74011:
URL: https://github.com/apache/airflow/pull/74011#discussion_r4171001368
##########
airflow-core/src/airflow/ui/src/hooks/useDateRangeFilter.ts:
##########
@@ -300,6 +286,30 @@ export const useDateRangeFilter = ({ onChange, translate, value }: UseDateRangeF
});
};
+ const commitEditingState = () => {
+ const { inputs } = editingState;
+
+ if (validateInputs(inputs).length > 0) {
+ return;
+ }
+
+ const nextStartDate = combineDateAndTime(inputs.start, inputs.startTime, {
+ timezone: selectedTimezone,
+ });
Review Comment:
Opening and closing the picker without edits seems to shift the value when the UI timezone differs from the browser's. With the browser in Asia/Seoul (UTC+9) and the UI timezone set to UTC, a filter starting at 1:00 AM UTC shows 10:00 AM in the inputs and comes back as 10:00 AM UTC on close. It looks like the inputs are filled in the browser timezone but read back in `selectedTimezone` here. What do you think?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix date range filter inputs committing on every keystroke [airflow]
Posted by "liwenjie200543 (via GitHub)" <gi...@apache.org>.
liwenjie200543 commented on code in PR #74011:
URL: https://github.com/apache/airflow/pull/74011#discussion_r4171789883
##########
airflow-core/src/airflow/ui/src/hooks/useDateRangeFilter.ts:
##########
@@ -300,6 +286,30 @@ export const useDateRangeFilter = ({ onChange, translate, value }: UseDateRangeF
});
};
+ const commitEditingState = () => {
+ const { inputs } = editingState;
+
+ if (validateInputs(inputs).length > 0) {
+ return;
+ }
+
+ const nextStartDate = combineDateAndTime(inputs.start, inputs.startTime, {
+ timezone: selectedTimezone,
+ });
Review Comment:
Good catch — confirmed and fixed in 2e3f01f9.
The inputs were filled in the browser timezone (`dayjs(value).format()`) while every commit path (typed edits, calendar picks, and the new commit-on-dismiss) interprets them in the selected timezone — so open + close re-committed the displayed wall time as if it were in the selected timezone. With a Seoul browser and a UTC UI, 01:00 UTC filled as 10:00 and came back as 10:00 UTC. The same mismatch also affected the calendar-click path, which committed browser-local day boundaries.
The fix:
- Fill the inputs (initial state, value-sync effect, and the invalid-input blur reset) in the selected timezone, matching the timezone label above them.
- Commit calendar picks as day boundaries in the selected timezone, so a click followed by dismissal re-derives the same value instead of shifting it.
- Compare at minute granularity on dismissal (the inputs are `HH:mm`), so re-deriving an unchanged range — e.g. a calendar-picked 23:59:59.999 end-of-day from a displayed 23:59 — no longer fires onChange.
- The value-sync effect also re-fills the inputs when the selected timezone changes.
Three regression tests cover your reported flow (with a browser/UI timezone mismatch chosen dynamically so it reproduces on any CI runner), the calendar-pick commit, and the parent-synced no-recommit case; all three fail without the fix.
One pre-existing nit I left out of scope: the calendar grid/highlight is still browser-local, so the highlighted day can differ by one from the inputs in cross-timezone setups. Happy to follow up separately if you want it fixed.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix date range filter inputs committing on every keystroke [airflow]
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #74011:
URL: https://github.com/apache/airflow/pull/74011#issuecomment-6046418209
Awesome work, congrats on your first merged pull request! You are invited to check our [Issue Tracker](https://github.com/apache/airflow/issues) for additional 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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org