From 61e19ebd25d40cb50a852f8cda81c0f8c00d7277 Mon Sep 17 00:00:00 2001 From: kangwei Date: Sun, 12 Jul 2020 19:43:26 +0800 Subject: [PATCH] fix addon callbacks --- packages/designer/src/document/node/node.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/designer/src/document/node/node.ts b/packages/designer/src/document/node/node.ts index 0369a43b1..952f3df01 100644 --- a/packages/designer/src/document/node/node.ts +++ b/packages/designer/src/document/node/node.ts @@ -157,7 +157,7 @@ export class Node { this.props = new Props(this, props, extras); this._children = new NodeChildren(this as ParentalNode, this.initialChildren(children)); this._children.interalInitParent(); - this.props.import(this.transformProps(props || {}), extras); + this.props.import(this.transformProps(props || {}), this.transformProps(extras || {})); this.setupAutoruns(); } @@ -167,7 +167,6 @@ export class Node { private transformProps(props: any): any { // FIXME! support PropsList return this.document.designer.transformProps(props, this, TransformStage.Init); - // TODO: run transducers in metadata.experimental } private autoruns?: Array<() => void>; @@ -542,14 +541,12 @@ export class Node { const _extras_: { [key: string]: any } = { ...extras, }; - if (_extras_) { - Object.keys(_extras_).forEach((key) => { - const addon = this._addons[key]; - if (addon) { - _extras_[key] = addon(); - } - }); - } + Object.keys(this._addons).forEach((key) => { + const addon = this._addons[key]; + if (addon) { + _extras_[key] = addon(); + } + }); const schema: any = { ...baseSchema,