From 8de5403b4c4f8320f09934ee0b5f3380e51e5da8 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Sat, 19 Feb 2022 00:17:34 +0100 Subject: [PATCH] feat: wip --- e2e/suspense-view/index.ts | 1 + e2e/suspense/notes.md | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/e2e/suspense-view/index.ts b/e2e/suspense-view/index.ts index 1cbbb407..b52718eb 100644 --- a/e2e/suspense-view/index.ts +++ b/e2e/suspense-view/index.ts @@ -16,6 +16,7 @@ import { h, onErrorCaptured, defineAsyncComponent, + onServerPrefetch, } from 'vue' const Home = defineComponent({ diff --git a/e2e/suspense/notes.md b/e2e/suspense/notes.md index 0f93a547..7bf775fa 100644 --- a/e2e/suspense/notes.md +++ b/e2e/suspense/notes.md @@ -136,18 +136,21 @@ import { getUser } from './api' /** * This is the component for /users/:id, it fetches the user information and display it. */ -const user = ref() +const user = useDataFetching() -// +--- Allows blocking the initial navigation +// +--- Allows blocking the entering navigation // | // v -await onBeforeNavigation(async (to, from) => { +onBeforeNavigation(async (to, from) => { // this will be executed on any navigation except when leaving (we can have a different hook like `onBeforeEach()`) - user.value = await getUser(to.params.id) + await user.fetch(to.params.id) + // user.value = await getUser(to.params.id) }) ``` + + Let's consider these routes: - Home `/`: Not Async -- 2.39.5