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

Handle Invalid template content #3064

Merged

Conversation

MichaelWest22
Copy link
Contributor

@MichaelWest22 MichaelWest22 commented Dec 8, 2024

Description

When trying to handle template tags inside svg tags in a htmx swap it can cause htmx to process the invalid template which is missing its template.content template fragment data causing a swap error. It seems v2 now scans all templates for oob swap data to handle situations where you need to wrap content in templates but this now causes issues for these invalid templates.

To fix this I've just added a null/undefined check before processing templates in case they have no valid template content data.

Corresponding issue:
#3059

Testing

To test this I've reproduced the problem in the linked issue and made sure this added null check avoids the error message.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

@Telroshan Telroshan added bug Something isn't working ready for review Issues that are ready to be considered for merging labels Dec 9, 2024
@1cg 1cg merged commit c24fb71 into bigskysoftware:dev Dec 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready for review Issues that are ready to be considered for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants