Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't execute asyncData in the vue router beforeEach。 #346

Open
gotoin opened this issue Jul 16, 2018 · 3 comments
Open

don't execute asyncData in the vue router beforeEach。 #346

gotoin opened this issue Jul 16, 2018 · 3 comments

Comments

@gotoin
Copy link

gotoin commented Jul 16, 2018

What problem does this feature solve?

cache !
i need realize forward refresh and backward do not refresh

now the asyncData is called every time before loading the component。

i need a configuration that sets the asyncData life cycle

thanks

This feature request is available on Nuxt community (#c54)
@ghost ghost added the cmty:feature-request label Jul 16, 2018
@renoirb
Copy link
Collaborator

renoirb commented Jul 17, 2018

Oh. Good call.
I've had similar issues to you and couldn't figure out what caused it.

I wonder what would be a better way.

PR?

@clarkdo
Copy link
Owner

clarkdo commented Jul 20, 2018

@gotoin @renoirb
If I understood correctly, you can combine the asyncData with store, only load data in asyncData when store is null, so that asyncData won't be called in backward.

@gotoin
Copy link
Author

gotoin commented Jul 20, 2018

@clarkdo
Yes, but i need implement a common solution, don't need to set each page,
as
page A -> B -> A -> go back(-1)

  1. A -> B , push A vnode cache, get B data from asyncData
  2. B -> A, push B vnode cache, get A data from asyncData
  3. go back(-1), pop B vnode from cache, then get A vnode

nuxt/nuxt#3541

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants