Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚠️🔧 HOTFIX - Fix client side exception on home page #3129

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export default async function RootLayout({
});

const liveStreamData: EventInfoStatic =
nextUG.data.eventsCalendarConnection.edges.length > 0
? nextUG.data.eventsCalendarConnection.edges[0].node
nextUG?.data?.eventsCalendarConnection?.edges?.length > 0
? nextUG?.data?.eventsCalendarConnection?.edges[0]?.node
: null;

return (
Expand All @@ -76,9 +76,11 @@ export default async function RootLayout({
>
<header className="no-print">
<Suspense>
<LiveStream event={liveStreamData}>
<MenuWrapper menu={menuData.data.megamenu.menuGroups} />
</LiveStream>
{liveStreamData && (
<LiveStream event={liveStreamData}>
<MenuWrapper menu={menuData.data.megamenu.menuGroups} />
</LiveStream>
)}
</Suspense>
</header>
<main className="grow bg-white">{children}</main>
Expand Down
4 changes: 2 additions & 2 deletions components/layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ export const Layout = ({
)}
>
<header className="no-print">
{(showBanner || router?.query?.liveBanner?.length > 0) && (
{event && (showBanner || router?.query?.liveBanner?.length > 0) && (
<LiveStreamBanner
countdownMins={countdownMins}
liveStreamData={event}
isLive={!!isLive}
/>
)}
<div className="mx-auto max-w-9xl px-8">
{(isLive || router.query.liveStream) && (
{event && (isLive || router?.query?.liveStream) && (
<LiveStreamWidget
event={event}
countdownMins={countdownMins}
Expand Down
6 changes: 3 additions & 3 deletions hooks/useLiveStreamProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export function useLiveStreamTimer(event: EventInfo): LiveStreamProps {

useEffect(() => {
const rightnow = dayjs().utc();
const liveDelay = event.liveStreamDelayMinutes ?? 0;
if (!liveStreamDelayMinutes && event.delayedLiveStreamStart) {
const liveDelay = event?.liveStreamDelayMinutes ?? 0;
if (!liveStreamDelayMinutes && event?.delayedLiveStreamStart) {
setLiveStreamDelayMinutes(liveDelay);
}

const start = dayjs(event.startDateTime).add(liveDelay, "minute");
const start = dayjs(event?.startDateTime).add(liveDelay, "minute");
const minsToStart = start.diff(rightnow, "minute");
setCountdownMins(minsToStart);

Expand Down
Loading