mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Preserve legacy widget input when rerendered (#1481)
This commit is contained in:
parent
1718ea827f
commit
771b642c70
@ -58,7 +58,7 @@ module.exports = function defineRenderer(renderingLogic) {
|
||||
|
||||
// Render the template associated with the component using the final template
|
||||
// data that we constructed
|
||||
var newProps = input || {};
|
||||
var newProps = input;
|
||||
var widgetConfig;
|
||||
var widgetState;
|
||||
var widgetBody;
|
||||
@ -111,6 +111,7 @@ module.exports = function defineRenderer(renderingLogic) {
|
||||
widgetBody = newProps.renderBody;
|
||||
}
|
||||
} else if (component) {
|
||||
newProps = newProps || component.___widgetProps;
|
||||
widgetBody = component.___legacyBody;
|
||||
widgetState = component.___rawState;
|
||||
widgetConfig = component.widgetConfig;
|
||||
|
||||
@ -160,6 +160,7 @@ module.exports = function defineWidget(def, renderer) {
|
||||
|
||||
self.___didUpdate = true;
|
||||
});
|
||||
this.___widgetProps = this.___input;
|
||||
this.___input = null;
|
||||
};
|
||||
|
||||
@ -167,6 +168,7 @@ module.exports = function defineWidget(def, renderer) {
|
||||
if (onUpdate) onUpdate.call(this);
|
||||
if (onRender && this.___didUpdate) onRender.call(this, {});
|
||||
this.___didUpdate = false;
|
||||
this.___widgetProps = this.___input;
|
||||
this.___input = null;
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user