fix: prevent withAsyncContext currentInstance leak in edge cases

This commit is contained in:
Evan You
2021-06-29 14:21:31 -04:00
parent 0240e82a38
commit 9ee41e14d2
3 changed files with 170 additions and 33 deletions

View File

@@ -623,6 +623,11 @@ function setupStatefulComponent(
currentInstance = null
if (isPromise(setupResult)) {
const unsetInstance = () => {
currentInstance = null
}
setupResult.then(unsetInstance, unsetInstance)
if (isSSR) {
// return the promise so server-renderer can wait on it
return setupResult