Skip to content

Commit

Permalink
feat: onbeforehydrate
Browse files Browse the repository at this point in the history
  • Loading branch information
HomyeeKing committed Oct 10, 2024
1 parent 942cb53 commit 83900e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/runtime/src/runClientApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
Expand Down
1 change: 1 addition & 0 deletions packages/runtime/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type App = Partial<{
strict: boolean;
errorBoundary: boolean;
onRecoverableError: (error: unknown, errorInfo: ErrorStack) => void;
onBeforeHydrate: () => void;
} & Record<AppLifecycle, VoidFunction>>;

export interface ErrorStack {
Expand Down

0 comments on commit 83900e3

Please sign in to comment.