Skip to content

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

@achu19

Description

@achu19
  • 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/antd-v5@2.3.2


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions