Skip to content

Commit

Permalink
fix: logic error inside genComponentStyleHook that caused a base st…
Browse files Browse the repository at this point in the history
…yle exception.
  • Loading branch information
YumoImer committed Jul 22, 2024
1 parent ea526eb commit f682a9f
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/util/genStyleUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,7 @@ export default function genStyleUtils<
const { max, min } = genMaxMin(type);

// Shared config
const sharedConfig: Omit<Parameters<typeof useStyleRegister>[0], 'path'> =
{
const sharedConfig: Omit<Parameters<typeof useStyleRegister>[0], 'path'> = {
theme,
token,
hashId,
Expand All @@ -396,7 +395,7 @@ export default function genStyleUtils<
// Generate style for all need reset tags.
useStyleRegister(
{ ...sharedConfig, clientOnly: false, path: ['Shared', rootPrefixCls] },
() => getResetStyles?.(token) ?? [],
() => typeof getResetStyles === 'function' ? getResetStyles(token) : [],
);

const wrapSSR = useStyleRegister(
Expand All @@ -412,7 +411,7 @@ export default function genStyleUtils<
CompTokenMap,
AliasToken,
C
>(component, realToken, getDefaultToken) ?? {};
>(component, realToken, getDefaultToken);

const componentCls = `.${prefixCls}`;
const componentToken = getComponentToken<CompTokenMap, AliasToken, C>(
Expand All @@ -437,8 +436,8 @@ export default function genStyleUtils<
{
componentCls,
prefixCls,
iconCls: !!iconPrefixCls.length ? '' : `.${iconPrefixCls}`,
antCls: !!rootPrefixCls.length ? '' : `.${rootPrefixCls}`,
iconCls: `.${iconPrefixCls}`,
antCls: `.${rootPrefixCls}`,
calc,
// @ts-ignore
max,
Expand All @@ -455,15 +454,18 @@ export default function genStyleUtils<
iconPrefixCls,
});
flush(component, componentToken);
return [
options.resetStyle === false
? null
: getCommonStyle?.(
const commonStyle = typeof getCommonStyle === 'function'
? getCommonStyle(
mergedToken,
prefixCls,
rootCls,
options.resetFont,
) ?? {},
options.resetFont
)
: null;
return [
options.resetStyle === false
? null
: commonStyle,
styleInterpolation,
];
},
Expand Down

0 comments on commit f682a9f

Please sign in to comment.