Preserve legacy widget input when rerendered (#1481)

This commit is contained in:
Dylan Piercey 2020-01-28 14:53:34 -08:00 committed by GitHub
parent 1718ea827f
commit 771b642c70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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;
};