fix(runtime-core/async-component): fix error component when there are no error handlers

fix #2129
This commit is contained in:
Evan You
2020-09-16 11:10:16 -04:00
parent bad0ecb910
commit c7b4a379cf
3 changed files with 67 additions and 7 deletions

View File

@@ -117,7 +117,12 @@ export function defineAsyncComponent<
const onError = (err: Error) => {
pendingRequest = null
handleError(err, instance, ErrorCodes.ASYNC_COMPONENT_LOADER)
handleError(
err,
instance,
ErrorCodes.ASYNC_COMPONENT_LOADER,
!errorComponent /* do not throw in dev if user provided error component */
)
}
// suspense-controlled or SSR.
@@ -152,7 +157,7 @@ export function defineAsyncComponent<
if (timeout != null) {
setTimeout(() => {
if (!loaded.value) {
if (!loaded.value && !error.value) {
const err = new Error(
`Async component timed out after ${timeout}ms.`
)