Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #1642 #521 do not updateDataToMP when destroy a component #1643

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/mpvue/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2179,7 +2179,7 @@ function mountComponent (
vm.$el = el;
if (!vm.$options.render) {
vm.$options.render = createEmptyVNode;

}
callHook(vm, 'beforeMount');

Expand Down Expand Up @@ -2274,7 +2274,7 @@ function updateChildComponent (
vm.$forceUpdate();
}


}

function isInInactiveTree (vm) {
Expand Down Expand Up @@ -2885,7 +2885,7 @@ function initMethods (vm, methods) {
var props = vm.$options.props;
for (var key in methods) {
vm[key] = methods[key] == null ? noop : bind(methods[key], vm);

}
}

Expand Down Expand Up @@ -5669,6 +5669,11 @@ function updateDataToMP () {
return
}

// 对于被销毁的节点,不更新data
if (this._isDestroyed) {
return
}

var data = formatVmData(this);
diffData(this, data);
throttleSetData(page.setData.bind(page), data);
Expand Down
5 changes: 5 additions & 0 deletions src/platforms/mp/runtime/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ export function updateDataToMP () {
return
}

// 对于被销毁的节点,不更新data
if (this._isDestroyed) {
return
}

const data = formatVmData(this)
diffData(this, data)
throttleSetData(page.setData.bind(page), data)
Expand Down