yjbanov / butterfly

A web framework for Dart based on Flutter's widget model
Apache License 2.0
156 stars 13 forks source link

Buggy heuristics when deciding between update and replace child #8

Open yjbanov opened 7 years ago

yjbanov commented 7 years ago

The expression in the if statement seems buggy. It seems that it will happily update a <div> with configuration for a <span> just because both are Element. Instead, we should add bool RenderNode.canUpdateFrom(Node config) and let the render node decide if it's compatible with the configuration object.

Another piece of code with the same issue: https://github.com/yjbanov/butterfly/blob/73914a4cda32d2c7f593da743ef424a62d6d2baa/lib/src/node.dart#L36