fix(devtools): clear devtools buffer after timeout

fix #4738
This commit is contained in:
Evan You 2021-10-07 19:36:32 -04:00
parent 646e694f0a
commit f4639e0a36

View File

@ -53,6 +53,11 @@ export function setDevtoolsHook(hook: DevtoolsHook, target: any) {
replay.push((newHook: DevtoolsHook) => { replay.push((newHook: DevtoolsHook) => {
setDevtoolsHook(newHook, target) setDevtoolsHook(newHook, target)
}) })
// clear buffer after 3s - the user probably doesn't have devtools installed
// at all, and keeping the buffer will cause memory leaks (#4738)
setTimeout(() => {
buffer = []
}, 3000)
} }
} }