Skip to content

Commit

Permalink
fix(design): hashId should be "" when hashed is false
Browse files Browse the repository at this point in the history
dengfuping committed Oct 18, 2023
1 parent 02338bb commit 46239d1
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/design/src/_util/genComponentStyleHook.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@ import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
import { genComponentStyleHook as antGenComponentStyleHook } from 'antd/es/theme/internal';
import type { GlobalToken } from 'antd/es/theme/interface';
import type { OverrideTokenWithoutDerivative } from 'antd/es/theme/util/genComponentStyleHook';
import { useContext } from 'react';
import theme from '../theme';

export type ComponentName = keyof ComponentTokenMap;

@@ -22,7 +24,10 @@ export function genComponentStyleHook(
},
getDefaultToken
);
const [wrapSSR, hashId] = useStyle(prefixCls);
const [wrapSSR] = useStyle(prefixCls);
// use hashId from useToken, as hashId is '' when hashed is false
// ref: https://github.com/ant-design/ant-design/blob/master/components/theme/useToken.ts#L80
const { hashId } = theme.useToken();
return {
wrapSSR,
hashId,
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

exports[`Badge status custom icon 1`] = `
<span
class="ant-badge ant-badge-status css-dev-only-do-not-override-amq5gd"
class="ant-badge ant-badge-status"
style="display: inline-block;"
>
<span
@@ -53,7 +53,7 @@ exports[`Badge status dot 1`] = `

exports[`Badge status icon 1`] = `
<span
class="ant-badge ant-badge-status css-dev-only-do-not-override-amq5gd"
class="ant-badge ant-badge-status"
style="display: inline-block;"
>
<span

0 comments on commit 46239d1

Please sign in to comment.