Subscribe on changes!

use computed in a SSR project does not active as expected

avatar
Dec 6th 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

avatar
Dec 6th 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