Skip to content

Commit c2b091a

Browse files
authored
perf: don't load ring.mp3 on booking page (calcom#21272)
1 parent 7093e1e commit c2b091a

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

apps/web/app/layout.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import React from "react";
77
import { getLocale } from "@calcom/features/auth/lib/getLocale";
88
import { loadTranslations } from "@calcom/lib/server/i18n";
99
import { IconSprites } from "@calcom/ui/components/icon";
10-
import { NotificationSoundHandler } from "@calcom/web/components/notification-sound-handler";
1110

1211
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
1312

@@ -152,13 +151,11 @@ export default async function RootLayout({ children }: { children: React.ReactNo
152151
]}
153152
/>
154153

155-
<Providers>
154+
<Providers isEmbed={isEmbed}>
156155
<AppRouterI18nProvider translations={translations} locale={locale} ns={ns}>
157156
{children}
158157
</AppRouterI18nProvider>
159158
</Providers>
160-
{!isEmbed && <NotificationSoundHandler />}
161-
<NotificationSoundHandler />
162159
</body>
163160
</html>
164161
);

apps/web/app/providers.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@ import { SessionProvider } from "next-auth/react";
55
import CacheProvider from "react-inlinesvg/provider";
66

77
import { WebPushProvider } from "@calcom/features/notifications/WebPushContext";
8+
import { NotificationSoundHandler } from "@calcom/web/components/notification-sound-handler";
89

910
import useIsBookingPage from "@lib/hooks/useIsBookingPage";
1011
import PlainChat from "@lib/plain/dynamicProvider";
1112

1213
type ProvidersProps = {
14+
isEmbed: boolean;
1315
children: React.ReactNode;
1416
};
15-
export function Providers({ children }: ProvidersProps) {
17+
export function Providers({ isEmbed, children }: ProvidersProps) {
1618
const isBookingPage = useIsBookingPage();
1719

1820
return (
1921
<SessionProvider>
2022
<TrpcProvider>
2123
{!isBookingPage ? <PlainChat /> : null}
24+
{!isEmbed && !isBookingPage && <NotificationSoundHandler />}
2225
{/* @ts-expect-error FIXME remove this comment when upgrading typescript to v5 */}
2326
<CacheProvider>
2427
<WebPushProvider>{children}</WebPushProvider>

0 commit comments

Comments
 (0)