I want to fetch data from the server side, my code is like this:

The problem is when I visit the page first time, there is no data injected(I check the webpage source code), and I try the second time which is good, then I can always get data normally.
here is the CLI log:

I notice that the blue number first time is too large than the second time visiting(maybe cause by cache), my question is why nuxt doesn鈥榯 wait until fetching data completely? how can I fix that problem?
@ummo not sure how your dispatch function looks like, maybe you forgot to return a promise?
Hi,
You should use async/await like this:
async fetch() {
await store.dispatch('templateList', ...)
return store.dispatch('categoryList', ...)
}
@dohomi solved my problem, thanks
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
@ummo not sure how your dispatch function looks like, maybe you forgot to return a promise?