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'
4
4
5
5
export function collectDataFromConstructor ( vm : Vue , Component : VueClass < Vue > ) {
6
6
// override _init to prevent to init as Vue instance
7
+ const originalInit = Component . prototype . _init
7
8
Component . prototype . _init = function ( this : Vue ) {
8
9
// proxy to actual vm
9
10
const keys = Object . getOwnPropertyNames ( vm )
@@ -29,6 +30,9 @@ export function collectDataFromConstructor (vm: Vue, Component: VueClass<Vue>) {
29
30
// should be acquired class property values
30
31
const data = new Component ( )
31
32
33
+ // restore original _init to avoid memory leak (#209)
34
+ Component . prototype . _init = originalInit
35
+
32
36
// create plain data object
33
37
const plainData = { }
34
38
Object . keys ( data ) . forEach ( key => {
You can’t perform that action at this time.
0 commit comments