From 25b8eab4ab9232ed57dc5ebdf4c12d200e7d4c42 Mon Sep 17 00:00:00 2001 From: wuhy Date: Thu, 8 Nov 2018 16:49:13 +0800 Subject: [PATCH] fix(okam-core): fix ant page onload data reference problem --- packages/okam-core/src/extend/data/observable/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/okam-core/src/extend/data/observable/index.js b/packages/okam-core/src/extend/data/observable/index.js index 0f322db9..f1972a8c 100644 --- a/packages/okam-core/src/extend/data/observable/index.js +++ b/packages/okam-core/src/extend/data/observable/index.js @@ -155,6 +155,14 @@ export default { this.__executeDataUpdate = this.$executeDataUpdate.bind(this); this.$dataListener = new EventListener(); + if (this.$rawComputed) { + // fix ant reference bug: `this.data.xx` operation is not allowed + // when page onload, otherwise it'll affect the init data state + // of the page when load next time. + // So, here create a shadow copy of data. + this.data = Object.assign({}, this.data); + } + this.__propsObserver = makePropsObservable(this); this.__dataObserver = makeDataObservable(this);