Skip to content

Fix date range filter inputs committing on every keystroke - #74011

Merged
bbovenzi merged 3 commits into
apache:mainfrom
liwenjie200543:fix/date-range-filter-keystroke-commit
Oct 7, 2026
Merged

bbovenzi merged 3 commits into
apache:mainfrom
liwenjie200543:fix/date-range-filter-keystroke-commit

Conversation

@liwenjie200543

Copy link
Copy Markdown
Contributor

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 DateInputs.

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?
  • Yes - ZCode (GLM)

Generated-by: ZCode (GLM) following the guidelines

)

Typing in the date range picker committed the partial value on every
keystroke, which updated the URL search params and let the sync effect
rewrite the inputs from the committed value mid-typing, so the typed
text flashed or got replaced. Keep edits local and commit explicitly:
pressing Enter, closing the popover, clicking the calendar, or clearing
a field. Invalid ranges are never committed.
@boring-cyborg boring-cyborg Bot added the area:UI Related to UI/UX. For Frontend Developers. label Oct 1, 2026
Comment thread airflow-core/src/airflow/ui/src/hooks/useDateRangeFilter.ts
The inputs were filled in the browser timezone while every commit path
(typed edits, calendar picks, popover dismissal) interprets them in the
selected timezone, so opening and closing the picker re-committed the
displayed wall time in the selected timezone and shifted the value
(e.g. 01:00 UTC displayed as 10:00 with a Seoul browser came back as
10:00 UTC). Fill the inputs in the selected timezone (initial state,
value sync, and the invalid-input blur reset), and commit calendar
picks as day boundaries in the selected timezone so a click followed
by dismissal re-derives the same value.

The dismissal commit now also compares at minute granularity (the
inputs are HH:mm), so re-deriving an unchanged range on close —
including a calendar-picked 23:59:59.999 end-of-day from a displayed
23:59, or a non-canonical value round-tripped from the URL — no longer
fires onChange, and the sync effect re-fills the inputs when the
selected timezone changes.

Generated-by: ZCode (GLM)
@eladkal eladkal added this to the Airflow 3.4.0 milestone Oct 4, 2026
@eladkal eladkal added the type:bug-fix Changelog: Bug Fixes label Oct 4, 2026
…(eslint/tsc/prettier verified clean locally)
@bbovenzi
bbovenzi merged commit d38e9ce into apache:main Oct 7, 2026
65 of 67 checks passed
@boring-cyborg

boring-cyborg Bot commented Oct 7, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers. type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Datepicker seems to update on each keystroke making it unusable

4 participants