Nuxt.js: [spa] Fetch is not called when accessing child page directly

Created on 19 Aug 2017  路  7Comments  路  Source: nuxt/nuxt.js

The fetch method is not called when you access a child page directly.

Reproduction project: https://github.com/cretueusebiu/nuxt-fetch-issue

Start the project and open the console:

Is this the expected behavior ?

From looking at the code this line seems to prevent fetch from being called on the parent component.

nuxt

This bug report is available on Nuxt.js community (#c1265)
available soon bug-confirmed

Most helpful comment

All 7 comments

@cretueusebiu What exactly are you expecting? When hard reload child page call [email protected] too?

I'm starting to use Nuxt recently, but for me, this is the expected behavior since index (home) and child are 2 different pages, with 2 different codes.

I normally use a middleware to make things globally. EG something need to happen in every page, like verify if the user is authenticated...

@gtso86 Yes.

@cretueusebiu got it...

When I disabled the mode: spa inside the nuxt.config.js and hard refresh the child page, I got both logs on my terminal, but still getting only the last one on devtools

image

Hi @cretueusebiu @gtso86

It seems to be a bug indeed, it should not call any fetch method on reload since everything is server-rendered.

I will take a look at it.

I just tried and universal mode is working perfecly:

But with spa mode (only client console):

Woking on it :)

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danieloprado picture danieloprado  路  3Comments

jaredreich picture jaredreich  路  3Comments

lazycrazy picture lazycrazy  路  3Comments

surmon-china picture surmon-china  路  3Comments

shyamchandranmec picture shyamchandranmec  路  3Comments