hyperscript: handles shared empty attrs, fixes #2821 #2822
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Whenever there are selector-derived attrs, the attrs object will be regenerated and not shared.
Description
When selector-derived attrs exist, the attrs object is regenerated. However, if the attrs object is empty, the attrs object is not regenerated, and the selector-derived attrs is unintentionally shared.
In this pr, the condition
!isEmpty(attrs)
was removed so that even if the attrs object is empty, the attrs object is regenerated if there are selector-derived attrs.Motivation and Context
One tiny bug #2821 has been fixed, and the code outlook is a bit better.
How Has This Been Tested?
Added test and ran
npm run build
.Types of changes
Checklist:
docs/changelog.md