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

v-if / v-else causes client side hydration to bail #4533

Closed
mediafreakch opened this issue Dec 21, 2016 · 1 comment
Closed

v-if / v-else causes client side hydration to bail #4533

mediafreakch opened this issue Dec 21, 2016 · 1 comment
Labels

Comments

@mediafreakch
Copy link

Vue.js version

2.1.6

Reproduction Link

https://github.com/mediafreakch/vue-hydration-bug

Steps to reproduce

Follow the Readme in my sample repository.
Once you've built the app and have started the webserver, go to localhost:8080 and observe the output in the console.

What is Expected?

Client side hydration should work.

What is actually happening?

Client side hydration bails because there is a mismatch between the client-side rendered vnodes and the server-side rendered nodeList.

I found out that something must have gone wrong with indentation in the template compilation process or with the v-if / v-else directives.

Compare this App.vue template (hydration bails):

    <a v-if="false">Foo</a>
    <a v-else class="disabled">&lt; prev</a>
    <span>bar</span>

to this (hydration works):

    <a v-if="false">Foo</a>
    <a v-else class="disabled">&lt; prev</a><span>bar</span>
@defcc
Copy link
Member

defcc commented Dec 22, 2016

Maybe we need to detect the whitespace text node and ignore it when hydrating.

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

No branches or pull requests

2 participants