Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react): hide SSR rendering error #573

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions packages/react/src/react/ssr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,14 @@ export const createComponentForServerSideRendering = <I extends HTMLElement, E e
/**
* if rendering the light DOM fails, we log a warning and continue to render the component
*/
const error = err instanceof Error ? err : new Error('Unknown error');
console.warn(
`${LOG_PREFIX} Failed to serialize light DOM for ${toSerialize.slice(0, -1)} />: ${
error.message
} - this may impact the hydration of the component`
);
if (process.env.STENCIL_SSR_DEBUG) {
const error = err instanceof Error ? err : new Error('Unknown error');
console.warn(
`${LOG_PREFIX} Failed to serialize light DOM for ${toSerialize.slice(0, -1)} />: ${
error.message
} - this may impact the hydration of the component`
);
}
}

const toSerializeWithChildren = `${toSerialize}${serializedChildren}</${options.tagName}>`;
Expand Down
Loading