fix: log error message if <Head> rendering fails (#75)
This commit is contained in:
+2
-1
@@ -10,9 +10,10 @@ export function Head(props: HeadProps) {
|
|||||||
let context: ComponentChildren[];
|
let context: ComponentChildren[];
|
||||||
try {
|
try {
|
||||||
context = useContext(HEAD_CONTEXT);
|
context = useContext(HEAD_CONTEXT);
|
||||||
} catch {
|
} catch (err) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"<Head> component is not supported in the browser, or during suspense renders.",
|
"<Head> component is not supported in the browser, or during suspense renders.",
|
||||||
|
{ cause: err },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
context.push(props.children);
|
context.push(props.children);
|
||||||
|
|||||||
Reference in New Issue
Block a user