File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { noop, warn } from './util'
44
55export function collectDataFromConstructor ( vm : Vue , Component : VueClass < Vue > ) {
66 // override _init to prevent to init as Vue instance
7+ const originalInit = Component . prototype . _init
78 Component . prototype . _init = function ( this : Vue ) {
89 // proxy to actual vm
910 const keys = Object . getOwnPropertyNames ( vm )
@@ -29,6 +30,9 @@ export function collectDataFromConstructor (vm: Vue, Component: VueClass<Vue>) {
2930 // should be acquired class property values
3031 const data = new Component ( )
3132
33+ // restore original _init to avoid memory leak (#209)
34+ Component . prototype . _init = originalInit
35+
3236 // create plain data object
3337 const plainData = { }
3438 Object . keys ( data ) . forEach ( key => {
You can’t perform that action at this time.
0 commit comments