You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "SkinnyPigeon (via GitHub)" <gi...@apache.org> on 2026/07/27 13:16:42 UTC

[PR] fix(explore): recompute currency_formats when dataset is saved from c… [superset]

SkinnyPigeon opened a new pull request, #42480:
URL: https://github.com/apache/superset/pull/42480

   ### SUMMARY
   
   When editing a metric's currency via **Edit Dataset** from the chart editor, the chart preview did not reflect the new currency until the page was refreshed.
   
   **Root cause:** `currency_formats` — a derived map of `metric_name → Currency` used by all chart plugins (as camelCase `currencyFormats`) — is only computed once in `hydrateExplore.ts` at initial page load. When `changeDatasource` is dispatched after an inline dataset save, it passes the raw API response directly to Redux. The API response contains the updated `metrics[].currency` data but never carries the pre-computed `currency_formats` field, so chart plugins receive `currencyFormats: {}` and render without any currency formatting.
   
   **Why removal appeared to work:** Removing a currency also results in `currencyFormats: {}`, which is the correct outcome (no currency → no formatting), so it appeared to work immediately.
   
   **Fix:** In `changeDatasource` — the canonical entry point for all datasource updates — derive `currency_formats` from `metrics[].currency` before dispatching, exactly mirroring what `hydrateExplore.ts` does on initial page load. This ensures every caller gets consistent, up-to-date currency formatting without any component needing to know about this derived field.
   
   Fixes #42468
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   **Before:** Changing a metric's currency in Edit Dataset has no effect on the chart preview; a full page refresh is required.
   
   **After:** The chart preview immediately reflects the updated currency after saving the dataset.
   
   https://github.com/user-attachments/assets/4641bf0f-cdc2-4c55-b5ea-91c340e038da
   
   
   ### TESTING INSTRUCTIONS
   
   1. Open an existing chart (e.g. a Big Number chart backed by a dataset with a metric).
   2. In Chart Source, click **...** beside the dataset name → **Edit Dataset**.
   3. Open the **Metrics** tab, expand a metric, and change its currency (e.g. from USD to EUR).
   4. Save the dataset and return to the chart preview.
   5. Verify the chart immediately renders with the updated currency symbol — no page refresh required.
   
   Automated: `npx jest --testPathPatterns="datasourcesActions.test"` — all 5 tests pass, including a new test that verifies `currency_formats` is correctly derived from metric currencies when `changeDatasource` is called.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: #42468
   - [ ] 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): recompute currency_formats when dataset is saved from c… [superset]

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


-- 
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): recompute currency_formats when dataset is saved from c… [superset]

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

   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): recompute currency_formats when dataset is saved from c… [superset]

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

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/42480?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 65.24%. Comparing base ([`6856d0f`](https://app.codecov.io/gh/apache/superset/commit/6856d0fc671dda62f4f305212b66e1bef8e8203e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`a75d6df`](https://app.codecov.io/gh/apache/superset/commit/a75d6dfdc64863b9e01fdee037311e9193b33060?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #42480      +/-   ##
   ==========================================
   - Coverage   65.25%   65.24%   -0.01%     
   ==========================================
     Files        2795     2795              
     Lines      157639   157643       +4     
     Branches    36052    36053       +1     
   ==========================================
   - Hits       102869   102856      -13     
   - Misses      52793    52810      +17     
     Partials     1977     1977              
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/42480/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/42480/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `71.32% <100.00%> (-0.02%)` | :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 Harness](https://app.codecov.io/gh/apache/superset/pull/42480?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