You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Look at the comments in src/components/HelloWorld.vue.
Steps to reproduce
Create a component with a named slot. E.g.: Wrapper.vue
Use the component with the named slot in the App.
Pass any other component (e.g.: SimpleComponent.vue) to the named slot.
Create an @method handler using any method on the component instance passed into the named slot, e.g.: @click="console.log('mock')"
Make the @method handler invalid by prefixing it with the await keyword as @click="await console.log('mock')"
What is expected?
While it is incorrect in fact to use await in @ handlers, one would expect the compiler to fail gracefully, as for example it does when the same is done with the default (unnamed) slot.
What is actually happening?
Compiler fails fatally with Syntax Error.
This may seem to be not a big problem, as using await is not valid in @method handlers anyway, but:
If multiple changes are made to the application, one may struggle to find out what went wrong, as the Syntax Error does not provide any context on the cause of the issue.
When using a complex build stack, where vue-loader is only part of the formula, this non-graceful shutdown from vue-loader can cause even more unexpected behaviour, as other components waiting for vue-loader to complete may stuck waiting without a proper error being returned, such as the issue reported here: Compilation hangs if QBtn @click contains await quasarframework/quasar#7736
Generally it is not a good idea to let a tool fail with syntax error due to semantic issue with input data.
The text was updated successfully, but these errors were encountered:
The reason the syntax is not recognized is similar to this one: vuejs/vue#11088 (comment), that await syntax can't be parsed by vue-template-es2015-compiler.
Uh oh!
There was an error while loading. Please reload this page.
Version
15.9.3
Reproduction link
https://codesandbox.io/s/fatal-error-if-using-await-in-method-on-a-component-passed-into-named-slot-b19r0
Look at the comments in
src/components/HelloWorld.vue
.Steps to reproduce
Wrapper.vue
SimpleComponent.vue
) to the named slot.@click="console.log('mock')"
await
keyword as@click="await console.log('mock')"
What is expected?
While it is incorrect in fact to use
await
in @ handlers, one would expect the compiler to fail gracefully, as for example it does when the same is done with the default (unnamed) slot.What is actually happening?
Compiler fails fatally with
Syntax Error
.This may seem to be not a big problem, as using
await
is not valid in @method handlers anyway, but:await
quasarframework/quasar#7736The text was updated successfully, but these errors were encountered: