PERF: Dirty checking was broken and re-rendering too often
This commit is contained in:
parent
ea0ecb67f3
commit
f3c535b945
|
@ -12,7 +12,10 @@ const _registry = {};
|
||||||
let _dirty = {};
|
let _dirty = {};
|
||||||
|
|
||||||
export function keyDirty(key, options) {
|
export function keyDirty(key, options) {
|
||||||
_dirty[key] = options || {};
|
options = options || {};
|
||||||
|
options.dirty = true;
|
||||||
|
|
||||||
|
_dirty[key] = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function renderedKey(key) {
|
export function renderedKey(key) {
|
||||||
|
@ -194,14 +197,17 @@ export default class Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prev) {
|
if (prev) {
|
||||||
const dirtyOpts = _dirty[prev.key] || {};
|
const dirtyOpts = _dirty[prev.key] || { dirty: false };
|
||||||
|
|
||||||
if (prev.shadowTree) {
|
if (prev.shadowTree) {
|
||||||
this.shadowTree = true;
|
this.shadowTree = true;
|
||||||
if (!dirtyOpts && !_dirty['*']) {
|
if (!dirtyOpts.dirty && !_dirty['*']) {
|
||||||
return prev.vnode;
|
return prev.vnode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
renderedKey(prev.key);
|
if (prev.key) {
|
||||||
|
renderedKey(prev.key);
|
||||||
|
}
|
||||||
|
|
||||||
const refreshAction = dirtyOpts.onRefresh;
|
const refreshAction = dirtyOpts.onRefresh;
|
||||||
if (refreshAction) {
|
if (refreshAction) {
|
||||||
|
|
Loading…
Reference in New Issue