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

use computed in a SSR project does not active as expected #5062

Closed
tedteddy opened this issue Dec 6, 2021 · 2 comments
Closed

use computed in a SSR project does not active as expected #5062

tedteddy opened this issue Dec 6, 2021 · 2 comments

Comments

@tedteddy
Copy link

tedteddy commented Dec 6, 2021

Version

3.2.23

Reproduction link

github.com

Steps to reproduce

step 1

yarn install

step 2

yarn dev

or

yarn build  &&  yarn start

What is expected?

DOM style should be

<div style="height: '200px', width: '200px',background: 'black'"></div>

in browser

What is actually happening?

DOM style is still

<div style="height: '100px', width: '100px', background: 'red'"></div>

in browser which is server-side-render result

@posva
Copy link
Member

posva commented Dec 6, 2021

Set the new value inside an onMounted() hook if you want to change it client side. It is expected to have the same values on the server and client when doing SSR

@posva posva closed this as completed Dec 6, 2021
@tedteddy
Copy link
Author

tedteddy commented Dec 6, 2021

#5063
@posva

@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants