bito-code-review[bot] commented on PR #42815:
URL: https://github.com/apache/superset/pull/42815#issuecomment-5220270544
<!-- Bito Reply -->
The flagged issue is valid. The current implementation of
`Theme.mergeConfig` only merges the Ant Design `token` object, which causes
Superset-specific ECharts overrides (often located outside the `token` object
in the configuration) to be lost during subsequent `setConfig` updates.
To resolve this, update `Theme.mergeConfig` to perform a deeper merge that
includes Superset-specific fields. Here is the corrected implementation for
`superset-frontend/packages/superset-core/src/theme/Theme.tsx`:
```typescript
private static mergeConfig(
config?: AnyThemeConfig,
baseTheme?: AnyThemeConfig,
): AnyThemeConfig | undefined {
if (baseTheme && config) {
// Merge the entire config object, not just the token property
const mergedConfig = { ...baseTheme, ...config, token: {
...baseTheme.token, ...config.token } };
// In Ant Design v5, colorLink derives from colorInfo, not
colorPrimary.
if (config.token?.colorPrimary && !config.token?.colorLink) {
mergedConfig.token.colorLink = config.token.colorPrimary;
}
return mergedConfig;
}
return config;
}
```
There are other comments on this PR. Would you like me to fetch and validate
them as well?
**superset-frontend/packages/superset-core/src/theme/Theme.tsx**
```
private static mergeConfig(
config?: AnyThemeConfig,
baseTheme?: AnyThemeConfig,
): AnyThemeConfig | undefined {
if (baseTheme && config) {
// Merge the entire config object, not just the token property
const mergedConfig = { ...baseTheme, ...config, token: {
...baseTheme.token, ...config.token } };
// In Ant Design v5, colorLink derives from colorInfo, not
colorPrimary.
if (config.token?.colorPrimary && !config.token?.colorLink) {
mergedConfig.token.colorLink = config.token.colorPrimary;
}
return mergedConfig;
}
return config;
}
```
--
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]