Skip to content

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

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

Open
boogiefromzk opened this issue Aug 19, 2022 · 1 comment
Labels
✨ feature request New feature or request

Comments

@boogiefromzk
Copy link

boogiefromzk commented Aug 19, 2022

What problem does this feature solve?

Here are discussions: vuejs/vue-router#1144 vuejs/vue#7209 vuejs/pinia#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.

@boogiefromzk boogiefromzk added the ✨ feature request New feature or request label Aug 19, 2022
@mefcorvi
Copy link
Contributor

Can't this be achieved by using the async setup and Suspense? Or by using the navigation guards from vue-router?

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

No branches or pull requests

2 participants