Bug: antd ProTable + next-intl breaks theme switch after locale change (Dark → Light) #9187
Replies: 1 comment
-
Hi @duc30012001! I'm Dosu and I’m helping the pro-components team. This is a known issue with ProTable's advanced style token cache: after a locale change (via next-intl), ProTable's style cache doesn't update, so when you switch themes, styles can break or become inconsistent. This doesn't affect base antd components because their style cache always stays in sync with the context, but ProTable's cache doesn't include the locale as a dependency, so it gets out of sync after a locale change followed by a theme switch. A robust workaround is to force a remount of the provider subtree (such as your ConfigProvider or ProConfigProvider) whenever either the theme or locale changes. You can do this by setting a <ConfigProvider key={`${theme}-${locale}`} theme={themeConfig} locale={antdLocale}>
<ProConfigProvider>
{/* ...your app... */}
</ProConfigProvider>
</ConfigProvider> This will flush and reestablish the style context and cache, keeping ProTable styles consistent after theme and locale changes. There is no public API in ProTable or ProConfigProvider to force style cache regeneration; the More details on the context and cache system can be found in the pro-components codebase. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using antd with ProTable in a Next.js app that also uses next-intl for internationalization and supports light/dark theme switching.
Reproduction Steps:
Stack
Beta Was this translation helpful? Give feedback.
All reactions