Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] genStyleHook方法未传递csp属性到useStyleRegister方法 #4256

Open
1 task
achu19 opened this issue Jan 3, 2025 · 0 comments
Open
1 task

Comments

@achu19
Copy link

achu19 commented Jan 3, 2025

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

https://github.com/formilyjs/antd/blob/2f67bd2e1979591cb8de77cfe0c68e5e48c1e471/packages/components/src/__builtins__/style.ts#L65

What is expected?

export const genStyleHook = (
component: ComponentName,
styleFn: (
token: TokenWithCommonCls,
info: StyleInfo
) => CSSInterpolation
) => {
return (prefixCls: string): UseComponentStyleResult => {
const { theme, token, hashId } = useToken()
const { getPrefixCls, iconPrefixCls } = useConfig()
const { getPrefixCls, iconPrefixCls, csp } = useConfig()
const rootPrefixCls = getPrefixCls()
return [
useStyleRegister(
{
nonce: csp?.nonce,
theme,
token,
hashId,
path: ['formily-antd', component, prefixCls, iconPrefixCls],
},
() => {

What is actually happening?

antd设置csp后,<ConfigProvider csp=‘abc'>,formily组件无法获取改csp值

Package

@formily/[email protected]


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

No branches or pull requests

1 participant