fix(auth): stabilize hydration-dependent UI

This commit is contained in:
2026-07-14 13:27:41 +08:00
parent b6551b6a5a
commit 8eaea17156
8 changed files with 175 additions and 66 deletions
+1
View File
@@ -3,5 +3,6 @@
*/
export * from "./use-breakpoint";
export * from "./use-has-hydrated";
export * from "./use-keyboard-height";
export * from "./use-pull-to-refresh";
+15
View File
@@ -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,
);
}