Skip to content

Commit

Permalink
fix(react): hide SSR rendering error (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann authored Dec 18, 2024
1 parent 419dacc commit 653642f
Showing 1 changed file with 8 additions and 6 deletions.
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

0 comments on commit 653642f

Please sign in to comment.