-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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: renderToString function not render properly nested slots when they are components #13432
fix: renderToString function not render properly nested slots when they are components #13432
Conversation
* add force HTMLString with local tests * remove local test & logs * remove test counter in basic exemple * re-add test & create SlotString instead of HTMLString
🦋 Changeset detectedLatest commit: afeff3b The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
CodSpeed Performance ReportMerging #13432 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a great fix! Thank you @P4tt4te!
Changes
Fixes #13067
In the initial issue, all slots passed to the renderToString function are considered strings, so when we pass them to the renderChild function, the HTML escaper breaks the component.
When a slot is passed to the renderToString function, a new SlotString is created.
I created a SlotString for now, but I don't know if this solution is the best approach (it's my first PR on Astro).
Let me know if it's correct or not. :)
Testing
I added a case inside
container-with-vitest\test\Card.test.ts
that reproduces the case displayed on the issue here.Docs
The documentation is already present as mentioned by the initial issue.