Skip to content

Did Vue hydrate successfully? #5907

@bjunc

Description

@bjunc

What problem does this feature solve?

According to the SSR hydration docs:

In development mode, Vue will assert the client-side generated virtual DOM tree matches the DOM structure rendered from the server. If there is a mismatch, it will bail hydration, discard existing DOM and render from scratch. In production mode, this assertion is disabled for maximum performance.

How would one know if hydration succeeded/failed? If "this assertion is disabled" in production, does that mean Vue defaults to discarding the DOM, or does Vue assume the server sent the proper markup? I would imagine a failed hydration would be something that would be nice to capture (eg. via Raven.captureException()) so it can be tracked / fixed.

What does the proposed API look like?

If there is indeed a "hydration mode", can that exposed as a global Vue.mode === 'hydration' (or Vue.hydrationMode === true if there are multiple "modes" that Vue can run in simultaneously)? Can a boolean/exception be exposed to let the developer know hydration succeeded?

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