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

m.domFor(): workaround for unintentional mangling. Fix #2842 #2981

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

kfule
Copy link
Contributor

@kfule kfule commented Sep 27, 2024

Refactoring of domFor() for the internal bundler.

Description

#2842 appears to be caused by a combination of the mangling of the internal bundler and the parameter destructuring of domFor().

function *domFor1({dom, domSize0}, {generation0} = {}) {

This pr avoids the parameter destructuring to fix the issue.

Motivation and Context

fix #2842

How Has This Been Tested?

Observing behavior of reproduction codes on the flems (#2842 (comment)) by replacing with the generated mithril.(min.)js.
Of course, npm run test has passed.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My change requires a documentation update, and I've opened a pull request to update it already:
  • I have read https://mithril.js.org/contributing.html.

@kfule kfule requested a review from a team as a code owner September 27, 2024 15:28
JAForbes
JAForbes previously approved these changes Sep 27, 2024
Copy link
Collaborator

@JAForbes JAForbes left a comment

Choose a reason for hiding this comment

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

Thanks @kfule, great find.

Approved, but I think a comment above the change referencing this PR would be useful. As my first thought would be to replace that logic with destructuring if I didn't know better.

JAForbes
JAForbes previously approved these changes Sep 27, 2024
@kfule
Copy link
Contributor Author

kfule commented Sep 27, 2024

@JAForbes
I've added a comment, could you please check it out.

@kfule
Copy link
Contributor Author

kfule commented Sep 29, 2024

@JAForbes Sorry, I found another destructuring in domFor(). This is not related to the bug, but it would be better to change it to keep the code consistency.

@JAForbes
Copy link
Collaborator

Thanks @kfule, I'll leave this for a day to give @MithrilJS/admins a chance to take a view, but if no objections after that we'll merge it 👍

@JAForbes JAForbes merged commit b5857a7 into MithrilJS:main Sep 30, 2024
7 checks passed
@JAForbes JAForbes mentioned this pull request Sep 30, 2024
@kfule kfule deleted the fix-domfor branch October 19, 2024 11:53
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.

Leftover DOM elements when switching between fragment and element
2 participants