Skip to content

Client data fetching in beforeMount mixin double-fetches #210

Closed
@phil294

Description

@phil294

Option 2, Fetch data after the matched view is rendered, calls asyncData in beforeMount.

The pseudo-syntax is

if (asyncData)
  asyncData()

This does not check if asyncData was already called by the server! Thus, guided by the official docs, this leads to duplicate fetches. In the case of dynamic module registration, even to duplicate modules.

What is the suggested way around this? Could we please have some documentation here?

If this issue is unclear, I explain it in greater detail at vuejs/vue#9252, including a repro link. But it is more of a docs issue

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