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

bug: Message Failed to serialize light DOM logged when resolving components #561

Open
3 tasks done
dwirz opened this issue Dec 9, 2024 · 1 comment
Open
3 tasks done
Labels

Comments

@dwirz
Copy link
Contributor

dwirz commented Dec 9, 2024

Prerequisites

Stencil Version

4.22.3

Stencil Framework Output Target

React

Stencil Framework Output Target Version

0.7.4

Current Behavior

The SSR component resolver does not properly handle all components and produces the following error in the logs:

[react-output-target] Failed to serialize light DOM for <my-button href="#" suppressHydrationWarning="true" />: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. - this may impact the hydration of the component

Expected Behavior

All components and their child components should be resolved correctly during SSR, ensuring that no error messages are logged. The serialization process should handle all component types properly to support seamless hydration.

Steps to Reproduce

Check out the stencil-ds-output-targets run:

pnpm install
pnpm build.react
pnpm start.next

Open the app on http://localhost:3000 and look into your terminal.

Code Reproduction URL

https://github.com/ionic-team/stencil-ds-output-targets

Additional Information

I submitted two PRs that address the problem:
1. Quick Fix: Provides a temporary solution but does not guarantee prevention of future issues. (#563)
2. Extended Logic: Adds more comprehensive logic to handle all possible ReactNode types. However, since I am not entirely familiar with React’s internals, I cannot guarantee its correctness. (#562)

Feel free to review the PRs, suggest improvements, or close either of them as you see fit.

@ionitron-bot ionitron-bot bot added the triage label Dec 9, 2024
Copy link

ionitron-bot bot commented Dec 9, 2024

Thanks for the issue!

This project is currently maintained for the purposes of supporting Ionic Framework. At this time, only new issues & pull requests that support Ionic Framework will be prioritized. For the latest updates regarding the maintenance status of this project, please see this section of the project's README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant