[Question] Await chain like promise chain
See original GitHub issueI got an situation here.
My team is using await
in a page that we need to handle more then one Promise
They tried to use something like this
<await(data from firstProvider)>
<await(complementData from secondProvider)>
</await>
</await>
They said to me they got some errors with nested await
and i was thinking in two solutions for this scenario
I was thinking about wrap the Promises in an especifc provider and use Promise.all(requests)
or create a custom tag like this one <await-all(data from [Promise1, Promise2, ....])</await-all>
What is the best solution to implement something like this?
What do you think about it??
Thanks and i’m in love with marko 🚀
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Using await in promise chain - javascript - Stack Overflow
yes, await can only be used inside a function that is async - a function inside an async function isn't async unless it...
Read more >Promises chaining - The Modern JavaScript Tutorial
Looks like promise chaining is meant to replace async/await structure. If you need to wait for something then just wrap it in a...
Read more >Promise chaining is dead. Long live async/await
In this article, we will look at how async/await really makes developers' lives easier and why you should stop using promise chaining.
Read more >Migrating from Promise chains to Async/Await - AfterAcademy
Introduces Async/Await and compare it with Promises. We shall discuss migrating your from Promise Chains to Async/Await .
Read more >Promises, Promise Chain and Async/Await - Time to Hack
Promises, Promise Chain and Async/Await ⏳ Callbacks were the old ways to handle asynchronous code execution; but with Promises, Promise Chains ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here’s my demo/test about this issue
https://github.com/mauricionr/marko-demo
the service
the controller
the view
Works well 🚀
But i could not see the Loading data and i’m using the tag
await-placeholder
Since i’m using
json-server
to fake and json api, i put an timeout to looks like the real world and could not see the loading.Any guess?
Thanks guys!!
@mlrawlings yes, but you can double check if really is server-side rendering here’s the demo