fix(config-provider): 修复嵌套主题配置泄漏 - #8574
Open
luozejian wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
描述
背景
Fixes #7885
嵌套使用
ConfigProvider theme时,局部主题 token 会写入全局globalDesignTokenApifallback,导致不在该ConfigProvider包裹范围内的兄弟组件也可能读取到局部主题配置。改动
DesignTokenProvider对globalDesignTokenApi的局部主题写入,仅通过 Vueprovide向后代组件传递 token。ConfigProvider内部组件使用自定义colorPrimary,外部兄弟组件保持默认colorPrimary的场景。验证
npx eslint components/theme/internal.ts components/config-provider/__tests__/index.test.jsnpm test -- components/config-provider/__tests__/index.test.js -t "should not leak nested theme token|autoInsertSpaceInButton|mount and unmount" --runInBand备注
完整
components/config-provider/__tests__/index.test.js当前仍有既有 CSP 用例失败,原因是旧测试读取Button内部$refs.wave.csp.nonce,与本次主题作用域修复无关。