diff --git a/packages/runtime/src/runClientApp.tsx b/packages/runtime/src/runClientApp.tsx index d354be4210..f268cb0d2e 100644 --- a/packages/runtime/src/runClientApp.tsx +++ b/packages/runtime/src/runClientApp.tsx @@ -120,6 +120,9 @@ export default async function runClientApp(options: RunClientAppOptions) { reportRecoverableError(error, errorInfo, { ignoreRuntimeWarning: revalidate }); }), }; + if (appConfig?.app?.onBeforeHydrate) { + appConfig?.app?.onBeforeHydrate(); + } return ReactDOM.hydrateRoot(container, element, hydrateOptions); }); } diff --git a/packages/runtime/src/types.ts b/packages/runtime/src/types.ts index 08e659e063..80f2adeeee 100644 --- a/packages/runtime/src/types.ts +++ b/packages/runtime/src/types.ts @@ -17,6 +17,7 @@ type App = Partial<{ strict: boolean; errorBoundary: boolean; onRecoverableError: (error: unknown, errorInfo: ErrorStack) => void; + onBeforeHydrate: () => void; } & Record>; export interface ErrorStack {