vuejs / vuejs/core

async clientPrefetch hook - analog of serverPrefetch, waiting for data loaded on client

Open
#6,509 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

:sparkles: feature request
Dominant language
TypeScript
Stars
54.4k
Forks
9.2k
Avg merge
1d 5h
Merged PRs (30d)
140

Description

What problem does this feature solve?

Here are discussions: https://github.com/vuejs/vue-router/issues/1144 https://github.com/vuejs/vue/issues/7209 https://github.com/vuejs/pinia/discussions/988
There are cases where you need some data fetched before other components are initialized (mount hook called), for example authentication checked or user data fetched.
Currently need to use watches, which might be multiple, instead of a simple mounted hook in child components.

What does the proposed API look like?

Just the same as serverPrefetch, but on client.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the proposed clientPrefetch hook with the existing serverPrefetch behavior, then review the linked Vue and Pinia discussions for the unresolved API expectations. Done means client-side data loading can be awaited before child components are initialized, with behavior analogous to serverPrefetch.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.