We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 15c919e commit b1b15f3Copy full SHA for b1b15f3
web/project-site/src/components/TableOfContents.tsx
@@ -29,8 +29,7 @@ export function TableOfContents() {
29
};
30
});
31
32
- // Defer the state update to avoid "setState in effect" warning and render cascades
33
- const timeoutId = setTimeout(() => setHeadings(items), 0);
+ setHeadings(items);
34
35
const observer = new IntersectionObserver(
36
(entries) => {
@@ -45,10 +44,7 @@ export function TableOfContents() {
45
44
46
elements.forEach((elem) => observer.observe(elem));
47
48
- return () => {
49
- clearTimeout(timeoutId);
50
- observer.disconnect();
51
- };
+ return () => observer.disconnect();
52
}, [location.pathname]);
53
54
if (headings.length === 0) return null;
0 commit comments