You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Abdulrehman-PIAIC80387 (via GitHub)" <gi...@apache.org> on 2026/04/09 11:21:01 UTC

[PR] fix(explore): dispatch onChange immediately on NumberControl stepper arrow clicks [superset]

Abdulrehman-PIAIC80387 opened a new pull request, #39220:
URL: https://github.com/apache/superset/pull/39220

   ### SUMMARY
   
   PR #37007 refactored `NumberControl` to defer `onChange` dispatch until blur (`onBlur`) to fix a field-clearing issue in matrixify. However, this introduced a regression: clicking the stepper arrows (up/down) updates the internal `pendingValueRef` but never triggers `onChange` because arrow clicks don't blur the input field — making the arrows appear broken.
   
   **Fix:** Add an `onStep` handler that immediately dispatches `onChange` when the stepper arrows are clicked, while preserving the blur-based dispatch for keyboard input.
   
   Fixes #39103
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   **Before:** Clicking stepper arrows updates the displayed value but the change never propagates to the parent component.
   
   **After:** Clicking stepper arrows immediately dispatches `onChange` to the parent component.
   
   ### TESTING INSTRUCTIONS
   
   1. Go to Explore view → select any chart that uses matrixify (e.g., a chart with the "Matrixified" tag)
   2. Find a `NumberControl` input with stepper arrows (up/down buttons)
   3. Click the up/down arrows — verify the value changes **and** the chart re-renders with the new value
   4. Also verify typing a value and tabbing away still works correctly
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #39103
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(explore): dispatch onChange immediately on NumberControl stepper arrow clicks [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39220:
URL: https://github.com/apache/superset/pull/39220#issuecomment-4254059940

   <!-- Bito Reply -->
   Yes, the suggestion is valid — it prevents duplicate onChange dispatches by tracking the last dispatched value and skipping blur dispatch when no new edits occurred after stepping.
   
   **superset-frontend/src/explore/components/controls/NumberControl/index.tsx**
   ```
   const lastDispatchedRef = useRef<number | undefined>(value);
   
     const handleStep = (val: number) => {
       pendingValueRef.current = val;
       onChange?.(val);
       lastDispatchedRef.current = val;
     };
   
     const handleBlur = () => {
       if (pendingValueRef.current !== lastDispatchedRef.current) {
         onChange?.(pendingValueRef.current);
         lastDispatchedRef.current = pendingValueRef.current;
       }
     };
   ```


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(explore): dispatch onChange immediately on NumberControl stepper arrow clicks [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #39220:
URL: https://github.com/apache/superset/pull/39220#issuecomment-4249811270

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/39220?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 64.37%. Comparing base ([`6649f35`](https://app.codecov.io/gh/apache/superset/commit/6649f35a0d6e5887efe8461ac3eec3167daa1a83?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`41ed0d6`](https://app.codecov.io/gh/apache/superset/commit/41ed0d6b51dfb182e979a14a50c04210e01b12be?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 39 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #39220      +/-   ##
   ==========================================
   - Coverage   64.37%   64.37%   -0.01%     
   ==========================================
     Files        2550     2550              
     Lines      132147   132150       +3     
     Branches    30661    30661              
   ==========================================
   - Hits        85075    85074       -1     
   - Misses      45587    45591       +4     
     Partials     1485     1485              
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/39220/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/39220/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.91% <100.00%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/39220?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(explore): dispatch onChange immediately on NumberControl stepper arrow clicks [superset]

Posted by "Abdulrehman-PIAIC80387 (via GitHub)" <gi...@apache.org>.
Abdulrehman-PIAIC80387 commented on PR #39220:
URL: https://github.com/apache/superset/pull/39220#issuecomment-4242724876

   Hi @rusackas @msyavuz — would one of you mind triggering CI on this PR when you have a moment? It's a small regression fix (one new prop + one test), and I'd like to confirm the tests pass before review. Happy to address any feedback. Thanks!


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(explore): dispatch onChange immediately on NumberControl stepper arrow clicks [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #39220:
URL: https://github.com/apache/superset/pull/39220


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(explore): dispatch onChange immediately on NumberControl stepper arrow clicks [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39220:
URL: https://github.com/apache/superset/pull/39220#issuecomment-4213735949

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(explore): dispatch onChange immediately on NumberControl stepper arrow clicks [superset]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #39220:
URL: https://github.com/apache/superset/pull/39220#discussion_r3088183477


##########
superset-frontend/src/explore/components/controls/NumberControl/index.tsx:
##########
@@ -71,6 +71,11 @@ export default function NumberControl({
     onChange?.(pendingValueRef.current);
   };
 
+  const handleStep = (val: number) => {
+    pendingValueRef.current = val;
+    onChange?.(val);
+  };

Review Comment:
   `handleStep` dispatches `onChange` immediately, but `handleBlur` will still dispatch the same `pendingValueRef.current` when the input later blurs. This can cause duplicate updates/queries for a single stepper interaction. Consider tracking the last-dispatched value (or a ref flag for step interactions) and skipping the blur dispatch when no new edits occurred after the step.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org