Skip to content

Add multiple style tag to support client components #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
Preview

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