Subscribe on changes!

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

avatar
Aug 19th 2022

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.

avatar
Aug 30th 2022

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