Static GitHub Issues

[2825] Sequence fetch/asyncData for nested route pages

prev: Nuxt build live crashes app
next: npm run dev does not wortk with starter template nuxt

In a nested parent / child page relationship (using <nuxt-child />), it would be ideal if the parent's fetch/asyncData functions ran before the children. Currently, they all seem to fire at once (even if async/await is used). Please correct me if I am wrong here.

For example, in the routing docs, we'd want category to complete its fetch before subCategory ran its fetch. That would make the parent category data available to the subCategory (eg. via the store).

Without this sequence, if you deep link to the subCategory, the parent category data may not have been set yet; preventing route checks that depend on that parent data, and/or the ability to append more granular data (unless dummy placeholders are added to the store). This essentially requires the subCategory to load the category data as part of the fetch; which results in the same data being loaded twice (once for the category and once for the subCategory).

Thoughts?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2457">#c2457</a>)</em></sub></div>