bito-code-review[bot] commented on PR #42485:
URL: https://github.com/apache/superset/pull/42485#issuecomment-5187526427
<!-- Bito Reply -->
The flagged issue is correct. The `getCurrencyFormats` utility introduced in
this PR provides a centralized way to derive currency lookups from metric
definitions. To resolve the issue, you should import `getCurrencyFormats` from
`@superset-ui/core` (or the local path if not yet exported) and apply it within
the `setDatasources` logic in `dashboardState.ts` whenever the datasource
payload is updated. This ensures that currency formatting metadata is
consistently recomputed rather than discarded during in-SPA refreshes.
**superset-frontend/packages/superset-ui-core/src/currency-format/utils.ts**
```
export const getCurrencyFormats = (
metrics?: Metric[] | null,
): Record<string, Currency> =>
Object.fromEntries(
ensureIsArray(metrics)
.filter(metric => !!metric.currency)
.map((metric): [string, Currency] => [
metric.metric_name,
metric.currency!,
]),
);
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]