Skip to content

fix(config-provider): 修复嵌套主题配置泄漏 - #8574

Open
luozejian wants to merge 1 commit into
vueComponent:mainfrom
luozejian:fix/config-provider-theme-scope
Open

fix(config-provider): 修复嵌套主题配置泄漏#8574
luozejian wants to merge 1 commit into
vueComponent:mainfrom
luozejian:fix/config-provider-theme-scope

Conversation

@luozejian

Copy link
Copy Markdown

描述

背景

Fixes #7885

嵌套使用 ConfigProvider theme 时,局部主题 token 会写入全局 globalDesignTokenApi fallback,导致不在该 ConfigProvider 包裹范围内的兄弟组件也可能读取到局部主题配置。

改动

  • 移除 DesignTokenProviderglobalDesignTokenApi 的局部主题写入,仅通过 Vue provide 向后代组件传递 token。
  • 新增回归测试,覆盖嵌套 ConfigProvider 内部组件使用自定义 colorPrimary,外部兄弟组件保持默认 colorPrimary 的场景。

验证

  • npx eslint components/theme/internal.ts components/config-provider/__tests__/index.test.js
  • npm 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,与本次主题作用域修复无关。

@luozejian luozejian mentioned this pull request Aug 10, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

config provider scope错误

1 participant