rebenitez1802 commented on PR #42874: URL: https://github.com/apache/superset/pull/42874#issuecomment-5219158414
**Two sources of truth for extra theme tokens** (non-blocking follow-up / hardening suggestion — not a merge blocker) In `superset-frontend/src/theme/utils/antdTokenNames.ts`, `getValidTokenNames()` bakes `getExtraThemeTokens()` into the module-level `validTokenNamesCache` on first call and never resets it, while the rewritten `isSupersetCustomToken()` and `getAllValidTokenNames()` read `getExtraThemeTokens()` **live** on every call. These paths agree today only because `getBootstrapData()` is itself memoized and warmed at import — an undocumented, load-bearing invariant. Two ways that can bite: - If the first `isValidTokenName` call ever runs before the `#app[data-bootstrap]` DOM is present, the cache freezes `extra = []` permanently, so registered tokens silently warn forever. - A future refactor that drops `getBootstrapData`'s memoization reintroduces true divergence between `isValidTokenName` (reads the frozen cache) and the other two helpers (read live). Suggestion: derive all three helpers from the single snapshot used to build `validTokenNamesCache` (or add a small cache-reset export used in tests), so consistency isn't an accident of double-memoization. -- 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]
