You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "anmolxlight (via GitHub)" <gi...@apache.org> on 2026/07/16 07:51:46 UTC

[PR] UI: Fix date range filter updating on each keystroke [airflow]

anmolxlight opened a new pull request, #69955:
URL: https://github.com/apache/airflow/pull/69955

   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 appear to flash or get replaced with formatted values.
   
   **Fix:** Remove the auto-submit from the input change handler. The editing state stays local until the user explicitly applies it via any of these paths:
   - Clicking a date in the calendar popover
   - Pressing Enter in any date/time input
   - Clicking the new Apply button
   - Closing the popover (clicking outside or pressing Escape)
   
   closes: #69891
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes - Claude Code (DeepSeek V4 Flash)
   
   Generated-by: Claude Code (DeepSeek V4 Flash) 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 updating on each keystroke [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi closed pull request #69955: Fix date range filter updating on each keystroke
URL: https://github.com/apache/airflow/pull/69955


-- 
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 updating on each keystroke [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #69955:
URL: https://github.com/apache/airflow/pull/69955#discussion_r3637186108


##########
airflow-core/src/airflow/ui/src/components/FilterBar/filters/DateRangeFilter.tsx:
##########
@@ -64,6 +65,12 @@ export const DateRangeFilter = ({ filter, onChange, onRemove }: FilterPluginProp
           defaultOpen={!hasValue}
           key={filter.id}
           lazyMount
+          onOpenChange={(details) => {
+            if (!details.open) {
+              // Submit the current editing state when the popover closes
+              applyDateRange();
+            }
+          }}

Review Comment:
   applyDateRange fires on every popover close. (Even when no edit has been done, a cheap check on the value could prevent this)



-- 
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] UI: Fix date range filter updating on each keystroke [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #69955:
URL: https://github.com/apache/airflow/pull/69955#issuecomment-5021876669

   @anmolxlight This PR has a few issues that need to be addressed before it can be reviewed — please see our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria).
   
   **Issues found:**
   - :x: **Pre-commit / static checks**: Failing: `CI image checks / Static checks`. Run `prek run --from-ref main --stage pre-commit` locally to reproduce and fix.
   
   **What to do next:**
   - Fix each issue listed above.
   - Make sure static checks pass locally (`prek run --from-ref main --stage pre-commit`).
   - Mark the PR as "Ready for review" when you're done.
   
   There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the [Airflow Slack](https://s.apache.org/airflow-slack).
   
   ---
   
   _Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this [two-stage triage process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated) so that our maintainers' limited time is spent where it matters most: the conversation with you._


-- 
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] UI: Fix date range filter updating on each keystroke [airflow]

Posted by "anmolxlight (via GitHub)" <gi...@apache.org>.
anmolxlight commented on code in PR #69955:
URL: https://github.com/apache/airflow/pull/69955#discussion_r3597993839


##########
airflow-core/src/airflow/ui/src/hooks/useDateRangeFilter.ts:
##########
@@ -318,6 +304,29 @@ export const useDateRangeFilter = ({ onChange, translate, value }: UseDateRangeF
 
   const hasValidationErrors = editingState.validationErrors.length > 0;
 
+  const applyDateRange = useCallback(() => {

Review Comment:
   Removed useCallback wrapper and import — React compiler handles memoization automatically per AGENTS.md.



##########
airflow-core/src/airflow/ui/src/components/FilterBar/filters/DateRangeInputs.tsx:
##########
@@ -186,6 +198,20 @@ export const DateRangeInputs = ({
           {getFieldError("range")?.message}
         </Text>
       )}
+
+      {onApply && (
+        <Button
+          borderRadius="md"
+          colorPalette="blue"
+          disabled={editingState.validationErrors.length > 0}
+          mt={1}
+          onClick={onApply}
+          size="sm"
+          width="full"
+        >
+          Apply
+        </Button>
+      )}

Review Comment:
   Removed the Apply button and onApply prop entirely. Popover onOpenChange already calls applyDateRange() on close — Enter/blur submit through popover dismissal.



-- 
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 updating on each keystroke [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #69955:
URL: https://github.com/apache/airflow/pull/69955#discussion_r3971503204


##########
airflow-core/src/airflow/ui/src/hooks/useDateRangeFilter.ts:
##########
@@ -318,7 +304,31 @@ export const useDateRangeFilter = ({ onChange, translate, value }: UseDateRangeF
 
   const hasValidationErrors = editingState.validationErrors.length > 0;
 
+  const applyDateRange = () => {
+    const { inputs } = editingState;
+    const errors = validateInputs(inputs);
+
+    // Don't apply if there are validation errors
+    if (errors.length > 0) {
+      return;

Review Comment:
   Can we double check that this return doesn't close the dateinput when there is an error?



-- 
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 updating on each keystroke [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #69955:
URL: https://github.com/apache/airflow/pull/69955#discussion_r3637178440


##########
airflow-core/src/airflow/ui/src/components/FilterBar/filters/DateInput.tsx:
##########
@@ -51,6 +52,7 @@ export const DateInput = ({
   onClear,
   onDateBlur,
   onFocus,
+  onKeyDown,

Review Comment:
   This prop seems like dead code, it's never passed. 



-- 
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] UI: Fix date range filter updating on each keystroke [airflow]

Posted by "anmolxlight (via GitHub)" <gi...@apache.org>.
anmolxlight commented on PR #69955:
URL: https://github.com/apache/airflow/pull/69955#issuecomment-5024679516

   Fixed the ts-compile-lint-ui ordering issue and rebased onto latest main. Let's see what CI says.


-- 
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 updating on each keystroke [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on PR #69955:
URL: https://github.com/apache/airflow/pull/69955#issuecomment-5781786688

   Closing as stale. If you want to come back to this, please rebase and then reopen this PR or a new one.


-- 
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] UI: Fix date range filter updating on each keystroke [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #69955:
URL: https://github.com/apache/airflow/pull/69955#discussion_r3596277051


##########
airflow-core/src/airflow/ui/src/hooks/useDateRangeFilter.ts:
##########
@@ -318,6 +304,29 @@ export const useDateRangeFilter = ({ onChange, translate, value }: UseDateRangeF
 
   const hasValidationErrors = editingState.validationErrors.length > 0;
 
+  const applyDateRange = useCallback(() => {

Review Comment:
   This useCallback isn't necessary. Please remove.



##########
airflow-core/src/airflow/ui/src/components/FilterBar/filters/DateRangeInputs.tsx:
##########
@@ -186,6 +198,20 @@ export const DateRangeInputs = ({
           {getFieldError("range")?.message}
         </Text>
       )}
+
+      {onApply && (
+        <Button
+          borderRadius="md"
+          colorPalette="blue"
+          disabled={editingState.validationErrors.length > 0}
+          mt={1}
+          onClick={onApply}
+          size="sm"
+          width="full"
+        >
+          Apply
+        </Button>
+      )}

Review Comment:
   Is this button necessary? Hitting "Enter/return" or clicking outside the popover should submit the date range. We don't have this in our other filter bar inputs. If it does help, then it should also close the popover.
   
   Anyways there are two other issues here:
   1. colorPalette should be "brand" as in other buttons we have
   2. Apply needs to have a translation key. Ideally using one we already have. I am sure "Submit" already exists
   
   



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