Fix hydration - check typeof window
This commit is contained in:
parent
4212c1f632
commit
6247bb42bc
1 changed files with 4 additions and 0 deletions
|
|
@ -49,6 +49,10 @@ export function FamilyProvider({ children: providerChildren }: { children: React
|
||||||
const [memberCount, setMemberCount] = useState(2);
|
const [memberCount, setMemberCount] = useState(2);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (typeof window === "undefined") {
|
||||||
|
setLoading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const path = window.location.pathname;
|
const path = window.location.pathname;
|
||||||
console.log("FamilyProvider: checking path =", path);
|
console.log("FamilyProvider: checking path =", path);
|
||||||
if (path.startsWith("/admin") || path === "/admin-login") {
|
if (path.startsWith("/admin") || path === "/admin-login") {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue