Properly destroy Vue components after they’re unmounted by React

This commit is contained in:
Samuel Elliott 2018-05-29 18:46:08 +01:00
parent 231afa8ed6
commit 4654025423
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
1 changed files with 5 additions and 0 deletions

View File

@ -59,6 +59,11 @@ export default class {
this.vueInstance.$mount(this.vueMount); this.vueInstance.$mount(this.vueMount);
} }
componentWillUnmount() {
this.vueInstance.$destroy();
delete this._vueInstance;
}
get vueMount() { get vueMount() {
const element = ReactDOM.findDOMNode(this); const element = ReactDOM.findDOMNode(this);
if (!element) return; if (!element) return;