From f77ddfc30ebb63c7432f2dda4e9ea64c504e4577 Mon Sep 17 00:00:00 2001 From: Chris-Robin Ennen Date: Mon, 3 Jun 2024 15:56:02 +0200 Subject: [PATCH] rename onBeforeMountApp to onBeforeRenderClient Signed-off-by: Chris-Robin Ennen --- packages/vike-vue-pinia/renderer/+config.ts | 2 +- packages/vike-vue-pinia/renderer/hydratePinia.ts | 4 ++-- packages/vike-vue-query/renderer/+config.ts | 2 +- packages/vike-vue-query/renderer/hydrateVueQuery.ts | 7 +++++-- packages/vike-vue/README.md | 2 +- packages/vike-vue/src/hooks/types.ts | 8 ++++---- packages/vike-vue/src/renderer/onRenderClient.ts | 4 ++-- packages/vike-vue/src/types/PageContext.ts | 6 +++--- 8 files changed, 19 insertions(+), 16 deletions(-) diff --git a/packages/vike-vue-pinia/renderer/+config.ts b/packages/vike-vue-pinia/renderer/+config.ts index ac61c250..928aed4d 100644 --- a/packages/vike-vue-pinia/renderer/+config.ts +++ b/packages/vike-vue-pinia/renderer/+config.ts @@ -4,7 +4,7 @@ export default { name: 'vike-vue-pinia', onCreateApp: 'import:vike-vue-pinia/renderer/installPinia:installPinia', onAfterRenderSSRApp: 'import:vike-vue-pinia/renderer/dehydratePinia:dehydratePinia', - onBeforeMountApp: 'import:vike-vue-pinia/renderer/hydratePinia:hydratePinia', + onBeforeRenderClient: 'import:vike-vue-pinia/renderer/hydratePinia:hydratePinia', } declare global { diff --git a/packages/vike-vue-pinia/renderer/hydratePinia.ts b/packages/vike-vue-pinia/renderer/hydratePinia.ts index 64286819..14f1b63f 100644 --- a/packages/vike-vue-pinia/renderer/hydratePinia.ts +++ b/packages/vike-vue-pinia/renderer/hydratePinia.ts @@ -1,8 +1,8 @@ -import type { OnBeforeMountAppSync } from 'vike-vue/types' +import type { onBeforeRenderClientSync } from 'vike-vue/types' export { hydratePinia } -const hydratePinia: OnBeforeMountAppSync = ({ pinia, fromHtmlRenderer }): ReturnType => { +const hydratePinia: onBeforeRenderClientSync = ({ pinia, fromHtmlRenderer }): ReturnType => { const { piniaInitialState } = fromHtmlRenderer if (!pinia || !piniaInitialState) { diff --git a/packages/vike-vue-query/renderer/+config.ts b/packages/vike-vue-query/renderer/+config.ts index dd09c4e3..a7128210 100644 --- a/packages/vike-vue-query/renderer/+config.ts +++ b/packages/vike-vue-query/renderer/+config.ts @@ -4,7 +4,7 @@ export default { name: 'vike-vue-query', onCreateApp: 'import:vike-vue-query/renderer/installVueQuery:installVueQuery', onAfterRenderSSRApp: 'import:vike-vue-query/renderer/dehydrateVueQuery:dehydrateVueQuery', - onBeforeMountApp: 'import:vike-vue-query/renderer/hydrateVueQuery:hydrateVueQuery', + onBeforeRenderClient: 'import:vike-vue-query/renderer/hydrateVueQuery:hydrateVueQuery', meta: { queryClientConfig: { env: { diff --git a/packages/vike-vue-query/renderer/hydrateVueQuery.ts b/packages/vike-vue-query/renderer/hydrateVueQuery.ts index 4a315d9a..196c8bf6 100644 --- a/packages/vike-vue-query/renderer/hydrateVueQuery.ts +++ b/packages/vike-vue-query/renderer/hydrateVueQuery.ts @@ -1,9 +1,12 @@ import { hydrate } from '@tanstack/vue-query' -import type { OnBeforeMountAppSync } from 'vike-vue/types' +import type { onBeforeRenderClientSync } from 'vike-vue/types' export { hydrateVueQuery } -const hydrateVueQuery: OnBeforeMountAppSync = ({ queryClient, fromHtmlRenderer }): ReturnType => { +const hydrateVueQuery: onBeforeRenderClientSync = ({ + queryClient, + fromHtmlRenderer, +}): ReturnType => { const { vueQueryInitialState } = fromHtmlRenderer if (!queryClient || !vueQueryInitialState) { diff --git a/packages/vike-vue/README.md b/packages/vike-vue/README.md index 6b8245b6..c830d65e 100644 --- a/packages/vike-vue/README.md +++ b/packages/vike-vue/README.md @@ -63,7 +63,7 @@ Vike and Vue. * [`onCreateApp()`](https://vike.dev/onCreateApp): Allows you to extend the Vue app, typically for registering a Vue plugin. * `onAfterRenderSSRApp()`: Called right after rendering the app on the server. Usually used for dehydration of state management libraries. -* `onBeforeMountApp()`: Called before mounting the app on the client. Usually used for hydration of state management libraries. +* `onBeforeRenderClient()`: Called before mounting the app on the client. Usually used for hydration of state management libraries. ## Settings diff --git a/packages/vike-vue/src/hooks/types.ts b/packages/vike-vue/src/hooks/types.ts index 9a918250..21356933 100644 --- a/packages/vike-vue/src/hooks/types.ts +++ b/packages/vike-vue/src/hooks/types.ts @@ -3,8 +3,8 @@ export type { OnCreateAppAsync, OnAfterRenderSSRAppSync, OnAfterRenderSSRAppAsync, - OnBeforeMountAppSync, - OnBeforeMountAppAsync, + OnBeforeRenderClientSync, + OnBeforeRenderClientAsync, } import type { PageContext } from 'vike/types' @@ -48,10 +48,10 @@ type OnAfterRenderSSRAppAsync = (pageContext: PageContext) => Promise void +type OnBeforeRenderClientSync = (pageContext: PageContext) => void /** * Hook called right before mounting the page's root Vue component. * * Typically used for hydrating state management libraries. */ -type OnBeforeMountAppAsync = (pageContext: PageContext) => Promise +type OnBeforeRenderClientAsync = (pageContext: PageContext) => Promise diff --git a/packages/vike-vue/src/renderer/onRenderClient.ts b/packages/vike-vue/src/renderer/onRenderClient.ts index fb6aec9a..9d75270c 100644 --- a/packages/vike-vue/src/renderer/onRenderClient.ts +++ b/packages/vike-vue/src/renderer/onRenderClient.ts @@ -21,12 +21,12 @@ const onRenderClient: OnRenderClientAsync = async (pageContext): ReturnType onAfterRenderSSRApp?: Array - onBeforeMountApp?: Array + onBeforeRenderClient?: Array } } }