Merge pull request #1093 from sveltejs/gh-1061-a

validate contents of await blocks
pull/1097/head
Rich Harris 7 years ago committed by GitHub
commit 2537db90be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -54,6 +54,12 @@ export default function validateHtml(validator: Validator, html: Node) {
if (node.else) {
visit(node.else);
}
if (node.type === 'AwaitBlock') {
visit(node.pending);
visit(node.then);
visit(node.catch);
}
}
html.children.forEach(visit);

@ -0,0 +1,17 @@
{{#await promise}}
<p>Loading</p>
{{then data}}
<Component :data />
{{catch err}}
<p>Error: {{err}}</p>
{{/await}}
<script>
import Component from './Component.html';
export default {
components: {
Component
}
};
</script>
Loading…
Cancel
Save