Răsfoiți Sursa

fix(devtools): clear devtools buffer after timeout

fix #4738
Evan You 4 ani în urmă
părinte
comite
f4639e0a36
1 a modificat fișierele cu 5 adăugiri și 0 ștergeri
  1. 5 0
      packages/runtime-core/src/devtools.ts

+ 5 - 0
packages/runtime-core/src/devtools.ts

@@ -53,6 +53,11 @@ export function setDevtoolsHook(hook: DevtoolsHook, target: any) {
     replay.push((newHook: DevtoolsHook) => {
       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)
   }
 }