Skip to content

Commit

Permalink
fix: toc may lost in visited pages
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Aug 25, 2023
1 parent 4ffe77e commit 7a4b980
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/client/theme-default/slots/Toc/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const Toc: FC = () => {
const { loading } = useSiteData();
const prevIndexRef = useRef(0);
const [sectionRefs, setSectionRefs] = useState<RefObject<HTMLElement>[]>([]);

const memoToc = React.useMemo(() => {
let toc = meta.toc;
if (tabMeta) {
Expand All @@ -43,7 +42,7 @@ const Toc: FC = () => {

setSectionRefs(refs as any);
}
}, [pathname, search, loading]);
}, [pathname, search, loading, memoToc]);

return sectionRefs.length ? (
<ScrollSpy sectionRefs={sectionRefs}>
Expand Down

0 comments on commit 7a4b980

Please sign in to comment.