From 35eec35220cfde272aaafa5f2fcced31dbc88c24 Mon Sep 17 00:00:00 2001 From: israellund Date: Tue, 19 Nov 2024 13:13:55 -0500 Subject: [PATCH] made changes to stop undefined length error when loading communities --- packages/commonwealth/client/scripts/hooks/useTopicGating.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/commonwealth/client/scripts/hooks/useTopicGating.ts b/packages/commonwealth/client/scripts/hooks/useTopicGating.ts index 5eb80c682c1..7dd80f017ec 100644 --- a/packages/commonwealth/client/scripts/hooks/useTopicGating.ts +++ b/packages/commonwealth/client/scripts/hooks/useTopicGating.ts @@ -33,7 +33,7 @@ const useTopicGating = ({ acc.push(current); // IMP: this logic can break if `PermissionEnum` or the `GroupPermissions` // schema is changed substantially and might not give off a ts issue. - } else if (current.permissions.length > existing.permissions.length) { + } else if (current?.permissions?.length > existing?.permissions?.length) { // Replace with the current item if it has a longer permission string const index = acc.indexOf(existing); acc[index] = current;