Nuxt.js: Fill store/fetch data on route prefetch

Created on 30 Jan 2019  路  1Comment  路  Source: nuxt/nuxt.js

What problem does this feature solve?

Routes are now able to be prefetched similair to quicklink. The problem is that there still needs to be data fetched for some routes which implement asyncData and/or fetch. This can be solved by enabling the page to prefetch data or fill the store before the route is being requested.

Prefetching can be done before the actual route transition. That means, that it's possible that the data is fetched while the route transition will never happen. Some Nuxt.js project might have implemented fetch and asyncData in a way that it requires the route transition to happen.

What does the proposed changes look like?

There could either be a new method being introduced called prefetch on page components or there could be a flag which enables prefetching on fetch and/or asyncData. This way, this feature is backwardscompatible.

This feature request is available on Nuxt community (#c8571)
feature-request

Most helpful comment

I had the similar idea @Timkor when thinking of the prefetching feature 馃槃

This feature is worth exploring, but only after the new asyncData that could be called everywhere (and not only in pages/).

>All comments

I had the similar idea @Timkor when thinking of the prefetching feature 馃槃

This feature is worth exploring, but only after the new asyncData that could be called everywhere (and not only in pages/).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gary149 picture gary149  路  3Comments

pehbehbeh picture pehbehbeh  路  3Comments

danieloprado picture danieloprado  路  3Comments

uptownhr picture uptownhr  路  3Comments

mattdharmon picture mattdharmon  路  3Comments