Skip to content

Commit

Permalink
refactor: tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 19, 2023
1 parent 1c049d9 commit b84e544
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/runtime-core/src/component.ts
Expand Up @@ -905,8 +905,8 @@ export function finishComponentSetup(
pauseTracking()
try {
applyOptions(instance)
resetTracking()
} finally {
resetTracking()
unsetCurrentInstance()
}
}
Expand Down
13 changes: 8 additions & 5 deletions packages/server-renderer/__tests__/render.spec.ts
Expand Up @@ -817,21 +817,24 @@ function testRender(type: string, render: typeof renderToString) {
const prev = getCurrentInstance()

expect(prev).toBe(null)

const Child = {
created() {
throw new Error()
}
}
try {
await render(
createApp({
errorCaptured() {
throw new Error()
},
template: `<div>hello</div>`,
created() {
throw new Error()
}
render: () => h(Child)
})
)
} catch {}
expect(
'Unhandled error during execution of created hook'
'Unhandled error during execution of errorCaptured hook'
).toHaveBeenWarned()
expect(getCurrentInstance()).toBe(null)
})
Expand Down

0 comments on commit b84e544

Please sign in to comment.