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(template-compiler): exclude comments from static parts when lwc:preserve-comments is disabled #3934

Merged
merged 11 commits into from
Jan 10, 2024

Conversation

jmsjtu
Copy link
Member

@jmsjtu jmsjtu commented Jan 9, 2024

Details

Fixes #3933.

The first commit (de9a127) contains the fix.

Does this pull request introduce a breaking change?

  • ✅ No, it does not introduce a breaking change.

Does this pull request introduce an observable change?

  • ⚠️ Yes, it does include an observable change.

Fixes a bug where comments are being included as part of static parts when lwc:preserve-comments is disabled. This causes a mismatch in the partsId between the compiler and runtime.

The error that is thrown for this bug will be removed.

GUS work item

W-14786540

@jmsjtu jmsjtu requested a review from a team as a code owner January 9, 2024 23:34
Comment on lines 587 to 592
if (!(isComment(node) && !this.preserveComments)) {
// Skip adding part index for comments when preserveComments is disabled.
// The partId represents the nodes in the DOM tree at runtime, comments will be
// stripped out when preserveComments is disabled.
partId++;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exclude comments from the partId count when lwc:preserve-comments is disabled as they will be stripped out at runtime.

Copy link
Member

@ekashida ekashida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestions

jmsjtu and others added 2 commits January 9, 2024 16:51
Co-authored-by: Ravi Jayaramappa <ravi.jayaramappa@salesforce.com>
@nolanlawson nolanlawson merged commit 97ec2c2 into master Jan 10, 2024
9 checks passed
@nolanlawson nolanlawson deleted the jtu/static-parts-comments-fix branch January 10, 2024 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTML comments leads to invalid events/refs on static content
4 participants