Skip to content

Commit b1b15f3

Browse files
committed
Revert "fix lint in TOC"
This reverts commit 15c919e.
1 parent 15c919e commit b1b15f3

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

web/project-site/src/components/TableOfContents.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ export function TableOfContents() {
2929
};
3030
});
3131

32-
// Defer the state update to avoid "setState in effect" warning and render cascades
33-
const timeoutId = setTimeout(() => setHeadings(items), 0);
32+
setHeadings(items);
3433

3534
const observer = new IntersectionObserver(
3635
(entries) => {
@@ -45,10 +44,7 @@ export function TableOfContents() {
4544

4645
elements.forEach((elem) => observer.observe(elem));
4746

48-
return () => {
49-
clearTimeout(timeoutId);
50-
observer.disconnect();
51-
};
47+
return () => observer.disconnect();
5248
}, [location.pathname]);
5349

5450
if (headings.length === 0) return null;

0 commit comments

Comments
 (0)