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

serverPrefetch not called in dev #1458

Closed
1 task done
mathieutu opened this issue Mar 18, 2019 · 5 comments
Closed
1 task done

serverPrefetch not called in dev #1458

mathieutu opened this issue Mar 18, 2019 · 5 comments

Comments

@mathieutu
Copy link
Contributor

mathieutu commented Mar 18, 2019

  • I confirm that this is an issue rather than a question.

Bug report

Version

1.0.0-alpha.44

Steps to reproduce

I have a serverPrefetch method in a component.
When building dist, the method is properly called and the component work.

When using dev server, the method seems to be not called.

async serverPrefetch() {
    this.foo = await fetchData();
  },

Thanks.
Matt'

@mathieutu
Copy link
Contributor Author

mathieutu commented Mar 18, 2019

Actually, I'm seeing that even if the method is called during the build, the foo data is emptied when the app loads. I probably missed something and will investigate further.

@ulivz
Copy link
Member

ulivz commented Mar 18, 2019

serverPrefetch was added in Vue@2.6+ but VuePress is powered by Vue@2.5+.

@ulivz ulivz closed this as completed Mar 18, 2019
@mathieutu
Copy link
Contributor Author

@ulivz You should not have read my previous messages, as you would know that it works.

Moreover, sorry to tell you that but actually vuepress is running vue@2.6.9, which is quite normal as it is requested as "vue": "^2.5.16", in https://github.com/vuejs/vuepress/blob/master/packages/%40vuepress/core/package.json#L57

@ulivz
Copy link
Member

ulivz commented Mar 18, 2019

@mathieutu
Copy link
Contributor Author

Yeah, I know that, this is server prefetching 🤷‍♂️ .
Are you saying that the dev server isn't doing any ssr at all?

I'm sorry but I totally don't understand what's going on here: firstly the wrong version response, and now this screenshot. Am I missing something? I'm sorry if I did or wrote something that bothered you. 🤔

Here what I'm trying to do is to make some calls only on server side, and not client side. It seems to work with build phase, but not dev one.

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

No branches or pull requests

2 participants