Skip to content

DOM shuffle after SSR hydration #9185

Closed as not planned
Closed as not planned
@Xowap

Description

@Xowap

Vue version

3.3.4

Link to minimal reproduction

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

https://stackblitz.com/edit/stackblitz-starters-lgtp6t?file=app.js

Steps to reproduce

The example is straight out of the Vue SSR doc, just with a different template. Just run example.js and visit localhost:3000.

What is expected?

It should display blocks in "AAA"/"BBB"/"CCC"/"AAA"/"BBB"/"CCC" order.

What is actually happening?

The SSR renders the HTML correctly but as soon as hydration kicks the order is kind of randomized, usually "AAA"/"BBB"/"CCC"/"CCC"/"AAA"/"BBB" on my machine.

System Info

System:
    OS: Linux 6.2 Ubuntu 23.04 23.04 (Lunar Lobster)
    CPU: (24) x64 AMD Ryzen 9 7900X 12-Core Processor
    Memory: 9.83 GB / 30.49 GB
    Container: Yes
    Shell: 3.6.0 - /usr/bin/fish
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
    pnpm: 8.1.0 - ~/.local/share/pnpm/pnpm
  Browsers:
    Chrome: 116.0.5845.140
  npmPackages:
    vue: ^3.3.4 => 3.3.4 

Any additional comments?

This bug popped in a complex Nuxt app, I've been able to dumb it down to this example which outlines its Vue origin. Presumably it affects all Vue 3 versions, at least those that I have tested (3.1 to 3.3 if I'm not mistaken).

To be noted as well that if you drop the .prod from the import map, the bug goes away, at least with this example (not sure if in the absolute).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions