Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Wxh16144 committed Nov 14, 2024
1 parent 957430a commit 70e0bc5
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/factories/createStyles/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useMemo from 'rc-util/lib/hooks/useMemo';
import isEqual from 'rc-util/lib/isEqual';
import React, { Context, useContext } from 'react';
import { Context, useContext } from 'react';

import { Emotion, createCSS, serializeCSS } from '@/core';
import type {
Expand Down Expand Up @@ -124,17 +124,16 @@ export const createStylesFactory =
return tempStyles;
},
[props, theme],
(prev: any[], next: any[]) =>
prev.some((prevDep, index) => {
const nextDep = next[index];

return !isEqual(prevDep, nextDep, true);
}),
(prev, next) => !isEqual(prev[0], next[0], true) || prev[1] !== next[1],
);

return React.useMemo(() => {
const { prefixCls, iconPrefixCls, ...res } = theme;
return { styles, cx, theme: res, prefixCls, iconPrefixCls };
}, [styles, theme]);
return useMemo(
() => {
const { prefixCls, iconPrefixCls, ...res } = theme;
return { styles, cx, theme: res, prefixCls, iconPrefixCls };
},
[styles, theme],
(prev, next) => !isEqual(prev[0], next[0], true) || prev[1] !== next[1],
);
};
};

0 comments on commit 70e0bc5

Please sign in to comment.