Skip to content

Commit

Permalink
🐛 Docs: 修复 wwads 造成的 client 水合不匹配 (#3106)
Browse files Browse the repository at this point in the history
  • Loading branch information
StarHeartHunt authored Nov 4, 2024
1 parent d766455 commit 23bcab5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions website/src/theme/Page/TOC/Container/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
import React from "react";

import "./styles.css";
import { useWindowSize } from "@nullbot/docusaurus-theme-nonepress/client";

import type { Props } from "@theme/Page/TOC/Container";
import OriginTOCContainer from "@theme-original/Page/TOC/Container";
import "./styles.css";

export default function TOCContainer({
children,
...props
}: Props): JSX.Element {
const windowSize = useWindowSize();
const isClient = windowSize !== "ssr";

return (
<OriginTOCContainer {...props}>
{children}
<div className="toc-ads-container">
<div className="wwads-cn wwads-vertical toc-ads" data-id="281"></div>
</div>
{isClient && (
<div className="toc-ads-container">
<div className="wwads-cn wwads-vertical toc-ads" data-id="281"></div>
</div>
)}
</OriginTOCContainer>
);
}

0 comments on commit 23bcab5

Please sign in to comment.