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 - classes are not re-applied on hydration without a ref #7787

Closed
KaelWD opened this issue Mar 10, 2018 · 4 comments
Closed

SSR - classes are not re-applied on hydration without a ref #7787

KaelWD opened this issue Mar 10, 2018 · 4 comments

Comments

@KaelWD
Copy link
Contributor

KaelWD commented Mar 10, 2018

Version

2.5.14

Reproduction link

No ref: https://codepen.io/anon/pen/yKyBYZ
With ref: https://codepen.io/anon/pen/PRwYPO

Steps to reproduce

Open the codepen

What is expected?

.has-padding should be applied after 2sec

What is actually happening?

Nothing changes on hydration unless the element has a ref


I opened a similar issue a while ago but for styles - #7063

Same thing happens with custom attributes btw, I'd expect this to give a "mismatched nodes" error at the very least:

No ref: https://codepen.io/anon/pen/qoExmb?editors=1010
With ref: https://codepen.io/anon/pen/oqgEWL?editors=1010

Text is fine though: https://codepen.io/anon/pen/OvPQQv?editors=1010

@yyx990803
Copy link
Member

You should do it in mounted. Mutating state in created will be affecting the output in SSR so it would have no effect.

@KaelWD
Copy link
Contributor Author

KaelWD commented Mar 11, 2018

Why does it work with a ref then? This is basically the same as #7063 but with a different attribute.

@johnleider
Copy link
Contributor

Is there a particular reason that #7063 qualifies as a bug but this does not?

@iranagame
Copy link

This issue still exist and has no workaround expect adding a ref to every single element which is not very elegant way!
Any ideas!?

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

4 participants