From 6e2e6c23ae3c811fedaf862264acefde4db4ce3f Mon Sep 17 00:00:00 2001 From: Julian Coy Date: Sun, 22 Mar 2020 13:51:55 -0400 Subject: [PATCH] refactored providedEvents to specificEventIds --- pages/[event].tsx | 2 +- shared/components/Events/Events.tsx | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pages/[event].tsx b/pages/[event].tsx index 167ec84..e0bde6f 100644 --- a/pages/[event].tsx +++ b/pages/[event].tsx @@ -40,7 +40,7 @@ export default withRedux(() => {

Related Events

- +

Event Details

{JSON.stringify(displayedEvent ?? {}, null, 2)}
diff --git a/shared/components/Events/Events.tsx b/shared/components/Events/Events.tsx index 7e206e3..cbd27a4 100644 --- a/shared/components/Events/Events.tsx +++ b/shared/components/Events/Events.tsx @@ -4,17 +4,19 @@ import { useEvents } from '../../../store/events'; import { useRenderCount } from '../../../utils/useRenderCount'; import { Event } from './Event'; -export const Events = ({ providedEvents }: { providedEvents?: string[] }) => { +export const Events = ({ specificEventIds }: { specificEventIds?: string[] }) => { const { initialized, events } = useEvents(); const renderCount = useRenderCount(); - if (!providedEvents && !initialized) return null; + if (!initialized) return null; + + const eventIds = specificEventIds || Object.keys(events); return ( <> {renderCount &&
Events render count: {renderCount}
}
- {(providedEvents || Object.keys(events)).map(id => { + {eventIds.map(id => { const event = events[id]; return event && ;