From 3aabecb5133ee41667a3b647a1d797cf1ac17913 Mon Sep 17 00:00:00 2001 From: Atridad Lahiji Date: Mon, 27 Jan 2025 22:39:47 -0600 Subject: [PATCH] Cleanup useEffects --- package.json | 2 +- src/components/features/invites/InviteCodes.tsx | 8 +------- src/components/features/users/UserList.tsx | 12 ++---------- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index aac3281..43991b4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pdsmanager", "type": "module", - "version": "0.3.4", + "version": "0.3.5", "scripts": { "dev": "astro dev", "build": "astro build", diff --git a/src/components/features/invites/InviteCodes.tsx b/src/components/features/invites/InviteCodes.tsx index bf70748..9c82333 100644 --- a/src/components/features/invites/InviteCodes.tsx +++ b/src/components/features/invites/InviteCodes.tsx @@ -175,15 +175,9 @@ export default function InviteCodes() { }, []); useEffect(() => { - if (typeof window !== "undefined") { - fetchCodes(); - } + fetchCodes(); }, [lastUpdate]); - if (typeof window === "undefined") { - return
; - } - return (
diff --git a/src/components/features/users/UserList.tsx b/src/components/features/users/UserList.tsx index 66876f6..e54d3c1 100644 --- a/src/components/features/users/UserList.tsx +++ b/src/components/features/users/UserList.tsx @@ -392,15 +392,11 @@ export default function UserList() { } } - if (typeof window !== "undefined") { - checkSettings(); - } + checkSettings(); }, [lastUpdate]); useEffect(() => { - if (typeof window !== "undefined" && hasValidSettings) { - fetchUsers(); - } + fetchUsers(); }, [lastUpdate, hasValidSettings]); useEffect(() => { @@ -409,10 +405,6 @@ export default function UserList() { }; }, []); - if (typeof window === "undefined") { - return
; - } - if (!settingsLoaded) { return (