Skip to content

Commit

Permalink
perf(core): disable computed props for later render
Browse files Browse the repository at this point in the history
  • Loading branch information
allen-zh committed Apr 17, 2019
1 parent 3de6acd commit 50c89fb
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions packages/mars-core/src/base/data.js
Expand Up @@ -4,11 +4,10 @@
*/

/* eslint-disable fecs-camelcase */

/* eslint-disable babel/new-cap */
/* eslint-disable no-console */

/* eslint-disable fecs-min-vars-per-destructure */

import {mark, measure} from '../helper/perf';
import config from '../config';
import {getMpUpdatedCallbacks} from './api/mpNextTick';
Expand Down Expand Up @@ -56,16 +55,14 @@ export function setData(vm, $mp, isRoot = false) {
const computed = getChangedComputed(vm);
data = Object.assign(data, computed, changed);
// 如果后续数据更新 需要计算新增的实例上的 computed 值
if (Object.keys(data).length > 0) {
// console.log('[pref start] getAllComputed');
const allComputed = getAllComputed(vm);
// console.log('[pref end] getAllComputed');
data = Object.keys(allComputed).length > 0
? Object.assign(data, {
[isRoot ? 'rootComputed' : 'compComputed']: allComputed
})
: data;
}
// if (Object.keys(data).length > 0) {
// const allComputed = getAllComputed(vm);
// data = Object.keys(allComputed).length > 0
// ? Object.assign(data, {
// [isRoot ? 'rootComputed' : 'compComputed']: allComputed
// })
// : data;
// }
}

if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
Expand Down

0 comments on commit 50c89fb

Please sign in to comment.