When I call diff with a node with widget children, the update method on the widget is never called.
function ExampleWidget() {}
ExampleWidget.prototype.type = 'Widget';
ExampleWidget.prototype.init = function () {
var vdom = h('p', ['hello!']);
return createElement(vdom);
}
ExampleWidget.prototype.update = function () {
console.log('widget update');
};
var widget = new ExampleWidget();
var first = h(
'p',
[widget]
);
// Something changes in widget
widget.someproperty = true;
var second = h(
'p',
[widget]
);
diff(first, second);
I expected update to be called (so that the widget can handle updates on its subtree), but it's never actually called. This occurs because the a === b optimisation at the start of diff.js#walk returns true (since it's the same widget object), so a VPatch.WIDGET patch is never emitted.
Am I just completely misunderstanding how widgets work? From what I can see, update on widgets will never be called currently.
When I call
diff
with a node with widget children, theupdate
method on the widget is never called.I expected
update
to be called (so that the widget can handle updates on its subtree), but it's never actually called. This occurs because thea === b
optimisation at the start ofdiff.js#walk
returns true (since it's the same widget object), so a VPatch.WIDGET patch is never emitted.Am I just completely misunderstanding how widgets work? From what I can see,
update
on widgets will never be called currently.