Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/AntdRegistry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ type AntdRegistryProps = Omit<StyleProviderProps, 'cache'>;

const AntdRegistry: FC<AntdRegistryProps> = (props) => {
const [cache] = useState(() => createCache());
const inserted = useRef(false);
const inserted = useRef('');

useServerInsertedHTML(() => {
const styleText = extractStyle(cache, { plain: true });

if (inserted.current) {
if (inserted.current === styleText) {
Copy link

Copilot AI May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an empty string as the initial value for 'inserted' can cause the condition to be true when styleText is empty, potentially skipping the intended style insertion. Consider initializing 'inserted' to null or undefined to avoid a conflict with a valid empty styleText.

Copilot uses AI. Check for mistakes.
return null;
}
inserted.current = true;
inserted.current = styleText;

return (
<style
Expand Down