universal-vue / uvue

Vue CLI plugin to create universal Vue applications with ease
https://universal-vue.github.io/docs/
MIT License
127 stars 13 forks source link

Fixed recursive wrapping of data function that leads to memory leak (asyncData plugin). #66

Open mr-luke opened 2 years ago

mr-luke commented 2 years ago

What kind of change does this PR introduce?

Fixed memory leak of asyncData plugin.

What is the current behavior?

There's a recursive wrapping of data function which adds a new level each time SSR renders same component. This leads up to stuck references of asyncData variable that cannot be collected by GC.

What is the new behavior?

Under first attempt the original data function is cloned to internal options' property to ensure that each wrapping works on correct function.

Checklist: