-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix: handle sole empty expression tags #10433
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
Conversation
When there's only a single expression tag and its value evaluates to the empty string, special handling is needed to create and insert a text node fixes #10426
🦋 Changeset detectedLatest commit: 4ef53cf The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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.
one tiny detail but otherwise LGTM
current_hydration_fragment.unshift(text); | ||
if (first_node) { | ||
/** @type {DocumentFragment} */ (first_node.parentNode).insertBefore(text, first_node); | ||
} | ||
return text; | ||
} | ||
|
||
if (first_node !== null) { | ||
if (first_node) { |
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.
I believe the explicit comparison is deliberate, since it results in more efficient bytecode
if (first_node) { | |
if (first_node !== null) { |
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.
I did change it because the comparison will be wrongfully false when first_node
is undefined
when the array is empty.
When there's only a single expression tag and its value evaluates to the empty string, special handling is needed to create and insert a text node
fixes #10426
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint