add error boundary to community home

This commit is contained in:
hzrd149
2023-10-04 10:33:19 -05:00
parent b5d1cbd041
commit 4a7c00b0d0
2 changed files with 5 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import { memo, useRef } from "react";
import { nip19 } from "nostr-tools";
import { Link as RouterLink } from "react-router-dom";
import { Box, Card, CardProps, Center, Flex, Heading, LinkBox, LinkOverlay, Text } from "@chakra-ui/react";
@@ -9,7 +10,6 @@ import { useRegisterIntersectionEntity } from "../../../providers/intersection-o
import { getEventUID } from "../../../helpers/nostr/events";
import { getCommunityImage, getCommunityName } from "../../../helpers/nostr/communities";
import CommunityDescription from "./community-description";
import { nip19 } from "nostr-tools";
import CommunityModList from "./community-mod-list";
function CommunityCard({ community, ...props }: Omit<CardProps, "children"> & { community: NostrEvent }) {

View File

@@ -15,6 +15,7 @@ import RelaySelectionProvider, { useRelaySelectionContext } from "../../provider
import { COMMUNITY_DEFINITION_KIND, validateCommunity } from "../../helpers/nostr/communities";
import { NostrEvent } from "../../types/nostr-event";
import { NostrQuery } from "../../types/nostr-query";
import { ErrorBoundary } from "../../components/error-boundary";
function CommunitiesHomePage() {
const { filter, listId } = usePeopleListContext();
@@ -47,7 +48,9 @@ function CommunitiesHomePage() {
</Flex>
<SimpleGrid spacing="2" columns={{ base: 1, lg: 2 }}>
{communities.map((event) => (
<CommunityCard key={getEventUID(event)} community={event} />
<ErrorBoundary>
<CommunityCard key={getEventUID(event)} community={event} />
</ErrorBoundary>
))}
</SimpleGrid>
</VerticalPageLayout>