fix(auth): stabilize hydration-dependent UI
This commit is contained in:
@@ -3,5 +3,6 @@
|
||||
*/
|
||||
|
||||
export * from "./use-breakpoint";
|
||||
export * from "./use-has-hydrated";
|
||||
export * from "./use-keyboard-height";
|
||||
export * from "./use-pull-to-refresh";
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { useSyncExternalStore } from "react";
|
||||
|
||||
const subscribe = () => () => undefined;
|
||||
const getClientSnapshot = () => true;
|
||||
const getServerSnapshot = () => false;
|
||||
|
||||
export function useHasHydrated(): boolean {
|
||||
return useSyncExternalStore(
|
||||
subscribe,
|
||||
getClientSnapshot,
|
||||
getServerSnapshot,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user