m.render() ignores the key of the vnode returned by comnponents #2654
Labels
Area: Core
For anything dealing with Mithril core itself
Type: Breaking Change
For any feature request or suggestion that could reasonably break existing code
Type: Gotcha
For unwanted behavior that is still correct under the given circumstances
I keep running into this gotcha whereby I have a solitary dynamically-keyed node as the return value of a components view, and changing the vnode key doesn't cause the node to reinitialise. The reason this doesn't work is that AFAICT component instances are the only case in which a user-supplied vnode isn't normalised as a list item. Just as
m(tag, ...vnodes)
is equivalent tom(tag, [...vnodes])
&m.render(el, vnode)
tom.render(el, [vnode])
, I suggest we normalise component view output such that instances are always fragments - which as well as obviating this edge case would have the added benefit of making vnode tree traversal easier to reason about.Reproduction here.
I'm happy to implement this myself.
The text was updated successfully, but these errors were encountered: