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

关于ssr时,渲染数据 serverPrefetch #53

Closed
dehyang opened this issue Jul 29, 2021 · 5 comments
Closed

关于ssr时,渲染数据 serverPrefetch #53

dehyang opened this issue Jul 29, 2021 · 5 comments

Comments

@dehyang
Copy link

dehyang commented Jul 29, 2021

在serverPrefetch里执行的数据加载直接用this.xxx,在页面渲染出来会瞬间被替换掉!

看了下vue-demo是用 store 解决的,想请问这是唯一解决方法吗?

然后 store 是否一直存在服务端的吗?如果一直存在客户端,会不会很吃内存? 对于N个客户端会不会造成共享?

@lzxb
Copy link
Contributor

lzxb commented Jul 29, 2021

store应该是每个请求进来,都单独创建一个实例,避免不同请求之间数据交叉污染。

@lzxb
Copy link
Contributor

lzxb commented Jul 29, 2021

请求结束后,服务端的store实例,正常的情况下也应该被内存回收。

@lzxb
Copy link
Contributor

lzxb commented Jul 29, 2021

内存的占用,实际上和你写CSR渲染的项目,占用的内存是一样的。

@lzxb
Copy link
Contributor

lzxb commented Jul 29, 2021

不存在说因为使用了SSR渲染,导致内存的占用提升很多

@dehyang
Copy link
Author

dehyang commented Jul 30, 2021

不存在说因为使用了SSR渲染,导致内存的占用提升很多

了解,也实际测了一下。谢谢

@dehyang dehyang closed this as completed Jul 30, 2021
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