fix(site): work around Astro SSR false "Invalid hook call" warnings (#600)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Darius Cepulis
2026-02-24 15:21:55 -06:00
committed by GitHub
co-authored by Claude Opus 4.6
parent c4ef94e823
commit c11395ece1
3 changed files with 9 additions and 3 deletions
+3 -1
View File
@@ -29,5 +29,7 @@ export function PreferenceSync() {
}
}, [framework]);
return null;
// Workaround: Astro SSR logs false "Invalid hook call" when a React
// component with hooks returns null. See withastro/astro#12283.
return <></>;
}
@@ -24,5 +24,7 @@ export function PreferenceUpdater({ currentFramework }: PreferenceUpdaterProps)
styleStore.set(style);
}, [currentFramework]);
return null;
// Workaround: Astro SSR logs false "Invalid hook call" when a React
// component with hooks returns null. See withastro/astro#12283.
return <></>;
}
@@ -12,7 +12,9 @@ export function TableOfContents({ headings }: TableOfContentsProps) {
const activeId = useActiveHeading(filteredHeadings);
if (filteredHeadings.length === 0) {
return null;
// Workaround: Astro SSR logs false "Invalid hook call" when a React
// component with hooks returns null. See withastro/astro#12283.
return <></>;
}
return (