Support scala-js-snabbdom-0.2.0-M3 and lazy property setting #284
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.
EDIT: PR is unnecessary and came from my lack of understanding how snabbdom keys are meant to be used. See comment below.
This PR comes from troubleshooting strange behavior in a webapp I'm making where the value property on some elements could sometimes not appear to update as I'd expect. In trying multiple solutions such as setting keys on the elements I'm updating, the only solution I've found that works is a combination of the following:
Html#setLazy
)Part of the reason why this works is that the behavior of the
Props
module in scala-js-snabbdom has changed between versions. In particular it no longer filters out thevalue
property on updates. Trying to addsetLazy
to the branch supporting v0.1.0 does not fix the issue.The way this is meant to work is, you will add
.setLazy
onto any elements that are exhibiting strange property-setting behavior, to delay setting those properties until after every other element is updated. If it's added to a normal element, it may change behavior, so it's only meant to be used in strange edge-cases where values or other properties appear as if they are not correctly being set.Alternatively -- if you can think of a more elegant way to solve the issues I've been experiencing without this kind of hack-ish solution, or without supporting a milestone-version of this library, I would love to hear it. I'm personally a bit nervous about this requiring a milestone version of scala-js-snabbdom and it has not been updated in quite some time. That being said, the behavior has not actually changed all that much from v0.1.0 from the looks of things and everything else appears to work as I'd expect so far, so YMMV.