Skip to content

Commit

Permalink
Merge pull request #9958 from hicommonwealth/israel.9956.length-error…
Browse files Browse the repository at this point in the history
…-loading-communities

made changes to stop undefined length error when loading communities
  • Loading branch information
ilijabojanovic authored Nov 19, 2024
2 parents 1ba693b + 35eec35 commit f6c4b45
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f6c4b45

Please sign in to comment.