Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

perf(web): cut share page client JS from 922KB to 508KB gzipped

Richie McIlroy73ebfff538eb
diff --git a/apps/web/actions/videos/translation-languages.ts b/apps/web/actions/videos/translation-languages.ts
index c0e881436..3419e049c 100644
--- a/apps/web/actions/videos/translation-languages.ts
+++ b/apps/web/actions/videos/translation-languages.ts
@@ -1,4 +1,8 @@
+// Deep import on purpose: this file is pulled into CLIENT code (the share
+// page's caption context), and the @cap/web-domain barrel would drag the
+// whole effect runtime (~250 KB gz) into that bundle. Language.ts itself is
+// dependency-free.
export {
type LanguageCode,
SUPPORTED_LANGUAGES,
-} from "@cap/web-domain";
+} from "@cap/web-domain/src/Language";
diff --git a/apps/web/app/(org)/dashboard/Contexts.tsx b/apps/web/app/(org)/dashboard/Contexts.tsx
index f130e0310..40f5ac3b0 100644
--- a/apps/web/app/(org)/dashboard/Contexts.tsx
+++ b/apps/web/app/(org)/dashboard/Contexts.tsx
@@ -3,67 +3,24 @@
import { buildEnv } from "@cap/env";
import Cookies from "js-cookie";
import { redirect, usePathname } from "next/navigation";
-import {
- createContext,
- useCallback,
- useContext,
- useEffect,
- useState,
-} from "react";
+import { useCallback, useEffect, useState } from "react";
import { InviteDialog } from "@/app/(org)/dashboard/settings/organization/components/InviteDialog";
-import { type CurrentUser, useCurrentUser } from "@/app/Layout/AuthContext";
+import { useCurrentUser } from "@/app/Layout/AuthContext";
import { UpgradeModal } from "@/components/UpgradeModal";
-import type {
- Organization,
- OrganizationSettings,
- Spaces,
- UserPreferences,
-} from "./dashboard-data";
+import {
+ DashboardContext,
+ type ITheme,
+ type SetThemeOptions,
+ type SharedContext,
+ ThemeContext,
+} from "./DashboardContext";
+import type { Spaces } from "./dashboard-data";
import type { DeveloperApp } from "./developers/developer-data";
-type SharedContext = {
- organizationData: Organization[] | null;
- activeOrganization: Organization | null;
- organizationSettings: OrganizationSettings | null;
- spacesData: Spaces[] | null;
- userSpaces: Spaces[] | null;
- sharedSpaces: Spaces[] | null;
- activeSpace: Spaces | null;
- user: CurrentUser;
- userCapsCount: number | null;
- toggleSidebarCollapsed: () => void;
- anyNewNotifications: boolean;
- userPreferences: UserPreferences;
- sidebarCollapsed: boolean;
- upgradeModalOpen: boolean;
- setUpgradeModalOpen: (open: boolean) => void;
- inviteDialogOpen: boolean;
- setInviteDialogOpen: (open: boolean) => void;
- referClickedState: boolean;
- setReferClickedStateHandler: (referClicked: boolean) => void;
- isDeveloperSection: boolean;
- developerApps: DeveloperApp[] | null;
- setDeveloperApps: (apps: DeveloperApp[] | null) => void;
-};
-
-type ITheme = "light" | "dark";
-type SetThemeOptions = {
- persist?: boolean;
-};
-
-const DashboardContext = createContext<SharedContext>({} as SharedContext);
-
-const ThemeContext = createContext<{
- theme: ITheme;
- setThemeHandler: (newTheme: ITheme, options?: SetThemeOptions) => void;
-}>({
- theme: "light",
- setThemeHandler: () => {},
-});
-
-export const useTheme = () => useContext(ThemeContext);
-
-export const useDashboardContext = () => useContext(DashboardContext);
+// The context objects and hooks live in `DashboardContext.ts` (so the share
+// page can read the context without pulling this file's dialogs); re-exported
+// here to keep the dashboard's existing import sites working unchanged.
+export { useDashboardContext, useTheme } from "./DashboardContext";
export function DashboardContexts({
children,
diff --git a/apps/web/app/s/[videoId]/Share.tsx b/apps/web/app/s/[videoId]/Share.tsx
index ac1ddf12f..639eb159b 100644
--- a/apps/web/app/s/[videoId]/Share.tsx
+++ b/apps/web/app/s/[videoId]/Share.tsx
@@ -31,7 +31,6 @@ import { PlaybackProvider } from "./_components/playback/PlaybackContext";
import { ShareVideo } from "./_components/ShareVideo";
import { type ShareView, ShareViewToggle } from "./_components/ShareViewToggle";
import { Sidebar } from "./_components/Sidebar";
-import SummaryChapters from "./_components/SummaryChapters";
import { Toolbar } from "./_components/Toolbar";
import { formatTimeAgo } from "./_components/tabs/Activity/utils";
import { TimelineSkeleton } from "./_components/timeline/TimelineSkeleton";
@@ -41,6 +40,11 @@ import type { VideoData } from "./types";
const importTimelineView = () => import("./_components/timeline/TimelineView");
const TimelineView = dynamic(importTimelineView, { ssr: false });
+// Carries react-markdown; split out and only rendered once AI data actually
+// exists, so videos without a summary never download it. SSR still renders
+// the summary into the initial HTML when the data is already there.
+const SummaryChapters = dynamic(() => import("./_components/SummaryChapters"));
+
/** Whether the viewer last left the comments rail collapsed. */
const RAIL_COLLAPSED_KEY = "cap_share_rail_collapsed";
@@ -332,9 +336,13 @@ export const Share = ({
header,
}: ShareProps) => {
const isScreenshot = data.isScreenshot === true;
- const effectiveDate: Date = data.metadata?.customCreatedAt
- ? new Date(data.metadata.customCreatedAt)
- : data.createdAt;
+ // Memoized: a fresh Date each render would defeat the memoized `data`
+ // objects below and re-render Sidebar's whole tree on every poll tick.
+ const customCreatedAt = data.metadata?.customCreatedAt;
+ const effectiveDate: Date = useMemo(
+ () => (customCreatedAt ? new Date(customCreatedAt) : data.createdAt),
+ [customCreatedAt, data.createdAt],
+ );
const playerRef = useRef<HTMLVideoElement | null>(null);
const stageRef = useRef<HTMLDivElement | null>(null);
@@ -574,6 +582,18 @@ export const Share = ({
);
}, [optimisticComments]);
+ // Stable identities for the spreads handed to ShareVideo and Sidebar —
+ // without these, every Share render (each 2s status poll while a video is
+ // processing) re-rendered both subtrees with brand-new `data` objects.
+ const shareVideoData = useMemo(
+ () => ({ ...data, transcriptionStatus }),
+ [data, transcriptionStatus],
+ );
+ const sidebarData = useMemo(
+ () => ({ ...data, createdAt: effectiveDate, transcriptionStatus }),
+ [data, effectiveDate, transcriptionStatus],
+ );
+
const reduceMotion = useReducedMotion() ?? false;
const [selectedView, setSelectedView] = useState<ShareView>(initialView);
// Screenshots have no timeline to show, and a comments-disabled video has
@@ -934,7 +954,7 @@ export const Share = ({
/>
) : (
<ShareVideo
- data={{ ...data, transcriptionStatus }}
+ data={shareVideoData}
comments={comments}
areChaptersDisabled={areChaptersDisabled}
areCaptionsDisabled={areCaptionsDisabled}
@@ -1081,15 +1101,21 @@ export const Share = ({
</div>
)}
- {!isScreenshot && (
- <SummaryChapters
- isSummaryDisabled={isSummaryDisabled}
- areChaptersDisabled={areChaptersDisabled}
- handleSeek={handleSeek}
- aiData={aiData}
- aiLoading={aiLoading}
- />
- )}
+ {/* Mirrors the component's own empty-state bail-out so the
+ chunk is never fetched for a video with nothing to show. */}
+ {!isScreenshot &&
+ !aiLoading &&
+ ((!isSummaryDisabled && Boolean(aiData.summary)) ||
+ (!areChaptersDisabled &&
+ (aiData.chapters?.length ?? 0) > 0)) && (
+ <SummaryChapters
+ isSummaryDisabled={isSummaryDisabled}
+ areChaptersDisabled={areChaptersDisabled}
+ handleSeek={handleSeek}
+ aiData={aiData}
+ aiLoading={aiLoading}
+ />
+ )}
</motion.div>
)}
</AnimatePresence>
@@ -1126,11 +1152,7 @@ export const Share = ({
)}
>
<Sidebar
- data={{
- ...data,
- createdAt: effectiveDate,
- transcriptionStatus,
- }}
+ data={sidebarData}
videoSettings={videoSettings}
commentsData={commentsData}
setCommentsData={setCommentsData}
diff --git a/apps/web/app/s/[videoId]/_components/CapVideoPlayer.tsx b/apps/web/app/s/[videoId]/_components/CapVideoPlayer.tsx
index 06064ec97..a72d05eb4 100644
--- a/apps/web/app/s/[videoId]/_components/CapVideoPlayer.tsx
+++ b/apps/web/app/s/[videoId]/_components/CapVideoPlayer.tsx
@@ -9,6 +9,7 @@ import { skipToken, useQuery, useQueryClient } from "@tanstack/react-query";
import clsx from "clsx";
import { AlertTriangleIcon, InfoIcon } from "lucide-react";
import { AnimatePresence, motion } from "motion/react";
+import dynamic from "next/dynamic";
import { useCallback, useEffect, useRef, useState } from "react";
import { createPortal } from "react-dom";
import { toast } from "sonner";
@@ -21,18 +22,18 @@ import {
isIosSafari,
probeAvcLevelFromUrl,
} from "./mp4-level-patch";
-import {
- canRetryFailedProcessing,
- getUploadFailureMessage,
- shouldDeferPlaybackSource,
- shouldReloadPlaybackAfterUploadCompletes,
- useUploadProgress,
-} from "./ProgressCircle";
import {
type ResolvedPlaybackSource,
resolvePlaybackSource,
shouldFallbackToRawPlaybackSource,
} from "./playback-source";
+import {
+ canRetryFailedProcessing,
+ getUploadFailureMessage,
+ shouldDeferPlaybackSource,
+ shouldReloadPlaybackAfterUploadCompletes,
+ type UploadProgress,
+} from "./upload-progress";
import { VideoPreviewGif } from "./VideoPreviewGif";
import {
MediaPlayer,
@@ -57,6 +58,12 @@ import {
import { Tooltip, TooltipContent, TooltipTrigger } from "./video/tooltip";
import { captureVideoFrameDataUrl } from "./video-frame-thumbnail";
+// Mounted only mid-upload; its RPC client drags the Effect runtime along, so
+// keeping it behind a dynamic import keeps that chunk off finished videos.
+const UploadProgressTracker = dynamic(() => import("./UploadProgressTracker"), {
+ ssr: false,
+});
+
const { circumference } = getProgressCircleConfig();
// Stable defaults: a `= []` in the destructuring mints a new array identity
@@ -196,10 +203,20 @@ export function CapVideoPlayer({
return () => window.removeEventListener("resize", checkMobile);
}, []);
- const uploadProgressRaw = useUploadProgress(
- videoId,
- hasActiveUpload || false,
- );
+ // Mirrors what `useUploadProgress(id, enabled)` returned inline: null when
+ // idle, "fetching" from the first enabled render. The hook itself now lives
+ // in the lazily-mounted tracker so finished videos skip its Effect chunk.
+ const trackUploadProgress = hasActiveUpload || false;
+ const [uploadProgressRaw, setUploadProgressRaw] =
+ useState<UploadProgress | null>(
+ trackUploadProgress ? { status: "fetching" } : null,
+ );
+ useEffect(() => {
+ // Both directions of an enable/disable flip mirror the old inline hook:
+ // tracking starting mid-session reads "fetching" immediately (the lazy
+ // tracker hasn't mounted yet), and stopping reads null.
+ setUploadProgressRaw(trackUploadProgress ? { status: "fetching" } : null);
+ }, [trackUploadProgress]);
const uploadProgress = blockPlaybackDuringProcessing
? uploadProgressRaw
: videoLoaded
@@ -614,6 +631,12 @@ export function CapVideoPlayer({
)}
autoHide
>
+ {trackUploadProgress && (
+ <UploadProgressTracker
+ videoId={videoId}
+ onChange={setUploadProgressRaw}
+ />
+ )}
{showUploadFailureOverlay && (
<div className="flex absolute inset-0 flex-col px-3 gap-3 z-[20] justify-center items-center bg-black transition-opacity duration-300">
<AlertTriangleIcon className="text-red-500 size-12" />
diff --git a/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsx b/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsx
index a2fa9948c..c4452fc86 100644
--- a/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsx
+++ b/apps/web/app/s/[videoId]/_components/HLSVideoPlayer.tsx
@@ -10,6 +10,7 @@ import clsx from "clsx";
import Hls from "hls.js";
import { AlertTriangleIcon } from "lucide-react";
import { AnimatePresence, motion } from "motion/react";
+import dynamic from "next/dynamic";
import { useRouter } from "next/navigation";
import { useCallback, useEffect, useRef, useState } from "react";
import { createPortal } from "react-dom";
@@ -22,8 +23,8 @@ import {
getUploadFailureMessage,
shouldDeferPlaybackSource,
shouldReloadPlaybackAfterUploadCompletes,
- useUploadProgress,
-} from "./ProgressCircle";
+ type UploadProgress,
+} from "./upload-progress";
import { VideoPreviewGif } from "./VideoPreviewGif";
import {
MediaPlayer,
@@ -46,6 +47,12 @@ import {
MediaPlayerVolumeIndicator,
} from "./video/media-player";
+// Mounted only mid-upload; its RPC client drags the Effect runtime along, so
+// keeping it behind a dynamic import keeps that chunk off finished videos.
+const UploadProgressTracker = dynamic(() => import("./UploadProgressTracker"), {
+ ssr: false,
+});
+
const { circumference } = getProgressCircleConfig();
const PROBE_MAX_RETRIES = 60;
@@ -185,10 +192,20 @@ export function HLSVideoPlayer({
videoLoadedRef.current = videoLoaded;
}, [videoLoaded]);
- const uploadProgressRaw = useUploadProgress(
- videoId,
- hasActiveUpload || false,
- );
+ // Mirrors what `useUploadProgress(id, enabled)` returned inline: null when
+ // idle, "fetching" from the first enabled render. The hook itself now lives
+ // in the lazily-mounted tracker so finished videos skip its Effect chunk.
+ const trackUploadProgress = hasActiveUpload || false;
+ const [uploadProgressRaw, setUploadProgressRaw] =
+ useState<UploadProgress | null>(
+ trackUploadProgress ? { status: "fetching" } : null,
+ );
+ useEffect(() => {
+ // Both directions of an enable/disable flip mirror the old inline hook:
+ // tracking starting mid-session reads "fetching" immediately (the lazy
+ // tracker hasn't mounted yet), and stopping reads null.
+ setUploadProgressRaw(trackUploadProgress ? { status: "fetching" } : null);
+ }, [trackUploadProgress]);
const shouldDelayPlaybackSource =
!allowSegmentProbeDuringUpload &&
shouldDeferPlaybackSource(uploadProgressRaw);
@@ -602,6 +619,12 @@ export function HLSVideoPlayer({
)}
autoHide
>
+ {trackUploadProgress && (
+ <UploadProgressTracker
+ videoId={videoId}
+ onChange={setUploadProgressRaw}
+ />
+ )}
{hasFailedOrError && (
<div className="flex absolute inset-0 flex-col px-3 gap-3 z-[20] justify-center items-center bg-black transition-opacity duration-300">
<AlertTriangleIcon className="text-red-500 size-12" />
diff --git a/apps/web/app/s/[videoId]/_components/ProgressCircle.tsx b/apps/web/app/s/[videoId]/_components/ProgressCircle.tsx
index b5009d36b..8aea8a326 100644
--- a/apps/web/app/s/[videoId]/_components/ProgressCircle.tsx
+++ b/apps/web/app/s/[videoId]/_components/ProgressCircle.tsx
@@ -4,122 +4,26 @@ import type { Video } from "@cap/web-domain";
import clsx from "clsx";
import { Effect, Option } from "effect";
import { useEffectQuery, useRpcClient } from "@/lib/EffectRuntime";
-
-type UploadProgress =
- | { status: "fetching" }
- | {
- status: "uploading";
- lastUpdated: Date;
- progress: number;
- }
- | {
- status: "processing";
- lastUpdated: Date;
- progress: number;
- message: string | null;
- }
- | {
- status: "generating_thumbnail";
- lastUpdated: Date;
- progress: number;
- }
- | {
- status: "error";
- lastUpdated: Date;
- errorMessage: string | null;
- hasRawFallback: boolean;
- }
- | {
- status: "failed";
- lastUpdated: Date;
- };
-
-export function shouldDeferPlaybackSource(
- uploadProgress: UploadProgress | null,
-): boolean {
- return (
- uploadProgress?.status === "fetching" ||
- uploadProgress?.status === "uploading"
- );
-}
-
-export function shouldReloadPlaybackAfterUploadCompletes(
- previousUploadProgress: UploadProgress | null,
- uploadProgress: UploadProgress | null,
- options: { includeFetching?: boolean } = {},
-): boolean {
- return (
- previousUploadProgress !== null &&
- (options.includeFetching || previousUploadProgress.status !== "fetching") &&
- uploadProgress === null
- );
-}
-
-export function canRetryFailedProcessing(
- uploadProgress: UploadProgress | null,
- canRetryProcessing: boolean,
-): boolean {
- return canRetryProcessing && uploadProgress?.status === "error";
-}
-
-export function getUploadFailureMessage(
- uploadProgress: UploadProgress | null,
- canRetryProcessing: boolean,
-): string {
- if (uploadProgress?.status === "error") {
- if (canRetryFailedProcessing(uploadProgress, canRetryProcessing)) {
- return uploadProgress.errorMessage || "Processing failed.";
- }
-
- return (
- uploadProgress.errorMessage ||
- "Processing failed. Ask the owner to retry processing or re-upload the recording."
- );
- }
-
- return "Upload stalled before processing finished. Re-upload the recording to continue.";
-}
-
-const SECOND = 1000;
-const MINUTE = 60 * SECOND;
-const HOUR = 60 * 60 * SECOND;
-const DAY = 24 * HOUR;
-const STALE_PROCESSING_START_MS = 90 * SECOND;
-const STALE_PROCESSING_PROGRESS_MS = 10 * MINUTE;
-const STALE_THUMBNAIL_MS = 5 * MINUTE;
-
-export function getStalledProcessingMessage(input: {
- phase:
- | "uploading"
- | "processing"
- | "generating_thumbnail"
- | "complete"
- | "error";
- updatedAt: Date;
- processingProgress: number;
-}): string | null {
- const ageMs = Date.now() - input.updatedAt.getTime();
-
- if (input.phase === "processing") {
- if (input.processingProgress === 0 && ageMs > STALE_PROCESSING_START_MS) {
- return "Video processing did not start. Retry processing.";
- }
-
- if (ageMs > STALE_PROCESSING_PROGRESS_MS) {
- return "Video processing stalled. Retry processing.";
- }
- }
-
- if (input.phase === "generating_thumbnail" && ageMs > STALE_THUMBNAIL_MS) {
- return "Video finishing stalled. Retry processing.";
- }
-
- if (input.phase === "complete" && ageMs > STALE_THUMBNAIL_MS) {
- return "Video finishing stalled. Retry processing.";
- }
-
- return null;
-}
+import {
+ DAY,
+ getStalledProcessingMessage,
+ HOUR,
+ MINUTE,
+ SECOND,
+ type UploadProgress,
+} from "./upload-progress";
+
+// The pure helpers moved to `upload-progress.ts` so consumers that only need
+// them don't pull the Effect runtime this file's hook depends on. Re-exported
+// here to keep existing import sites (embed, dashboard) working unchanged.
+export {
+ canRetryFailedProcessing,
+ getStalledProcessingMessage,
+ getUploadFailureMessage,
+ shouldDeferPlaybackSource,
+ shouldReloadPlaybackAfterUploadCompletes,
+ type UploadProgress,
+} from "./upload-progress";
export function useUploadProgress(
videoId: Video.VideoId,
diff --git a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx b/apps/web/app/s/[videoId]/_components/ShareHeader.tsx
index 4cba554c7..ab783c082 100644
--- a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx
+++ b/apps/web/app/s/[videoId]/_components/ShareHeader.tsx
@@ -14,14 +14,12 @@ import type { ViewerSettingKey } from "@cap/web-backend";
import {
faChartSimple,
faChevronDown,
- faCopy,
faEllipsis,
faGear,
faLock,
faShare,
faTrash,
faUnlock,
- faVideo,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { skipToken, useQuery, useQueryClient } from "@tanstack/react-query";
@@ -39,7 +37,6 @@ import {
Users,
X,
} from "lucide-react";
-import moment from "moment";
import dynamic from "next/dynamic";
import Image from "next/image";
import { useRouter } from "next/navigation";
@@ -51,17 +48,11 @@ import {
} from "@/actions/organization/shareable-link-icon";
import { editTitle } from "@/actions/videos/edit-title";
import type { VideoStatusResult } from "@/actions/videos/get-status";
-import { ConfirmationDialog } from "@/app/(org)/dashboard/_components/ConfirmationDialog";
-import { useDashboardContext } from "@/app/(org)/dashboard/Contexts";
-import { PasswordDialog } from "@/app/(org)/dashboard/caps/components/PasswordDialog";
-import { SettingsDialog } from "@/app/(org)/dashboard/caps/components/SettingsDialog";
-import { SharingDialog } from "@/app/(org)/dashboard/caps/components/SharingDialog";
+import { useDashboardContext } from "@/app/(org)/dashboard/DashboardContext";
import type { Spaces } from "@/app/(org)/dashboard/dashboard-data";
import { useCurrentUser } from "@/app/Layout/AuthContext";
import { SignedImageUrl } from "@/components/SignedImageUrl";
import { Tooltip } from "@/components/Tooltip";
-import { UpgradeModal } from "@/components/UpgradeModal";
-import { useEffectMutation, useRpcClient } from "@/lib/EffectRuntime";
import {
copyRichVideoLink,
videoPreviewImageUrl,
@@ -71,6 +62,7 @@ import { navigateWithTransition } from "@/utils/view-transition";
import type { SharePageBranding, VideoData } from "../types";
import { describeShareAudience } from "./share-audience";
import { useVideoDownload } from "./use-video-download";
+import { fromNow } from "./utils/from-now";
import { VideoDownloadMenu } from "./VideoDownloadMenu";
/**
@@ -81,6 +73,43 @@ import { VideoDownloadMenu } from "./VideoDownloadMenu";
const importShareLinkDialog = () => import("./ShareLinkDialog");
const ShareLinkDialog = dynamic(importShareLinkDialog, { ssr: false });
+/**
+ * Same treatment for the rest of the header's interaction-only surfaces. The
+ * owner dialogs and the upgrade modal (which carries the Rive animation
+ * runtime) are mounted behind latches; the two RPC-backed pieces additionally
+ * keep the Effect runtime chunk out of every plain page view.
+ */
+const importUpgradeModal = () =>
+ import("@/components/UpgradeModal").then((m) => m.UpgradeModal);
+const UpgradeModal = dynamic(importUpgradeModal, { ssr: false });
+const SharingDialog = dynamic(
+ () =>
+ import("@/app/(org)/dashboard/caps/components/SharingDialog").then(
+ (m) => m.SharingDialog,
+ ),
+ { ssr: false },
+);
+const SettingsDialog = dynamic(
+ () =>
+ import("@/app/(org)/dashboard/caps/components/SettingsDialog").then(
+ (m) => m.SettingsDialog,
+ ),
+ { ssr: false },
+);
+const PasswordDialog = dynamic(
+ () =>
+ import("@/app/(org)/dashboard/caps/components/PasswordDialog").then(
+ (m) => m.PasswordDialog,
+ ),
+ { ssr: false },
+);
+const DeleteCapDialog = dynamic(() => import("./DeleteCapDialog"), {
+ ssr: false,
+});
+const DuplicateCapMenuItem = dynamic(() => import("./DuplicateCapMenuItem"), {
+ ssr: false,
+});
+
/**
* Where a signed-out viewer can go next. Three, not the full site nav: this
* shares the row with the video's title and has to stay out of its way.
@@ -159,15 +188,40 @@ export const ShareHeader = ({
const [displayTitle, setDisplayTitle] = useState(data.name);
const [editValue, setEditValue] = useState(data.name);
const [isTitleRevealing, setIsTitleRevealing] = useState(false);
- const [upgradeModalOpen, setUpgradeModalOpen] = useState(false);
- const [isSharingDialogOpen, setIsSharingDialogOpen] = useState(false);
+ const [upgradeModalOpen, setUpgradeModalOpenRaw] = useState(false);
+ const [isSharingDialogOpen, setIsSharingDialogOpenRaw] = useState(false);
const [isShareLinkDialogOpen, setIsShareLinkDialogOpen] = useState(false);
- // Latched so the lazy chunk is only ever pulled in once, and so the dialog
+ // Latched so each lazy chunk is only ever pulled in once, and so a dialog
// keeps its exit animation instead of being torn out of the tree on close.
const [shareLinkDialogMounted, setShareLinkDialogMounted] = useState(false);
- const [isSettingsDialogOpen, setIsSettingsDialogOpen] = useState(false);
- const [isPasswordDialogOpen, setIsPasswordDialogOpen] = useState(false);
- const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
+ const [upgradeModalMounted, setUpgradeModalMounted] = useState(false);
+ const [sharingDialogMounted, setSharingDialogMounted] = useState(false);
+ const [settingsDialogMounted, setSettingsDialogMounted] = useState(false);
+ const [passwordDialogMounted, setPasswordDialogMounted] = useState(false);
+ const [deleteDialogMounted, setDeleteDialogMounted] = useState(false);
+ const [isSettingsDialogOpen, setIsSettingsDialogOpenRaw] = useState(false);
+ const [isPasswordDialogOpen, setIsPasswordDialogOpenRaw] = useState(false);
+ const [isDeleteDialogOpen, setIsDeleteDialogOpenRaw] = useState(false);
+ const setUpgradeModalOpen = (open: boolean) => {
+ if (open) setUpgradeModalMounted(true);
+ setUpgradeModalOpenRaw(open);
+ };
+ const setIsSharingDialogOpen = (open: boolean) => {
+ if (open) setSharingDialogMounted(true);
+ setIsSharingDialogOpenRaw(open);
+ };
+ const setIsSettingsDialogOpen = (open: boolean) => {
+ if (open) setSettingsDialogMounted(true);
+ setIsSettingsDialogOpenRaw(open);
+ };
+ const setIsPasswordDialogOpen = (open: boolean) => {
+ if (open) setPasswordDialogMounted(true);
+ setIsPasswordDialogOpenRaw(open);
+ };
+ const setIsDeleteDialogOpen = (open: boolean) => {
+ if (open) setDeleteDialogMounted(true);
+ setIsDeleteDialogOpenRaw(open);
+ };
const [passwordProtected, setPasswordProtected] = useState(
Boolean(data.hasPassword),
);
@@ -214,31 +268,6 @@ export const ShareHeader = ({
const effectiveSharedSpaces = contextSharedSpaces || sharedSpaces;
const isOwner = user && user.id === data.owner.id;
- const rpc = useRpcClient();
-
- const duplicateMutation = useEffectMutation({
- mutationFn: () => rpc.VideoDuplicate(data.id),
- onSuccess: () => {
- toast.success("Cap duplicated successfully");
- },
- onError: () => {
- toast.error("Failed to duplicate Cap");
- },
- });
-
- const deleteMutation = useEffectMutation({
- mutationFn: () => rpc.VideoDelete(data.id),
- onSuccess: () => {
- toast.success("Cap deleted successfully");
- push("/dashboard/caps?page=1");
- },
- onError: () => {
- toast.error("Failed to delete Cap");
- },
- onSettled: () => {
- setIsDeleteDialogOpen(false);
- },
- });
const { webUrl } = usePublicEnv();
const { download, isDownloading } = useVideoDownload(data.id);
@@ -710,21 +739,23 @@ export const ShareHeader = ({
</Button>
</div>
)}
- <SharingDialog
- isOpen={isSharingDialogOpen}
- onClose={() => setIsSharingDialogOpen(false)}
- capId={data.id}
- capName={data.name}
- sharedSpaces={effectiveSharedSpaces || []}
- onSharingUpdated={handleSharingUpdated}
- isPublic={data.public}
- spacesData={spacesData}
- hasPassword={passwordProtected}
- inheritedPasswordSources={data.inheritedPasswordSources}
- onPasswordUpdated={handlePasswordUpdated}
- user={user}
- onUpgradeRequest={setUpgradeModalOpen}
- />
+ {sharingDialogMounted && (
+ <SharingDialog
+ isOpen={isSharingDialogOpen}
+ onClose={() => setIsSharingDialogOpen(false)}
+ capId={data.id}
+ capName={data.name}
+ sharedSpaces={effectiveSharedSpaces || []}
+ onSharingUpdated={handleSharingUpdated}
+ isPublic={data.public}
+ spacesData={spacesData}
+ hasPassword={passwordProtected}
+ inheritedPasswordSources={data.inheritedPasswordSources}
+ onPasswordUpdated={handlePasswordUpdated}
+ user={user}
+ onUpgradeRequest={setUpgradeModalOpen}
+ />
+ )}
{shareLinkDialogMounted && (
<ShareLinkDialog
open={isShareLinkDialogOpen}
@@ -742,34 +773,35 @@ export const ShareHeader = ({
)}
{isOwner && (
<>
- <SettingsDialog
- isOpen={isSettingsDialogOpen}
- onClose={() => setIsSettingsDialogOpen(false)}
- capId={data.id}
- settingsData={data.videoSettings ?? undefined}
- inheritedSpaceSettings={data.inheritedSpaceSettings}
- user={user}
- organizationSettings={data.orgSettings}
- onSaved={refresh}
- />
- <PasswordDialog
- isOpen={isPasswordDialogOpen}
- onClose={() => setIsPasswordDialogOpen(false)}
- videoId={data.id}
- hasPassword={passwordProtected}
- onPasswordUpdated={handlePasswordUpdated}
- />
- <ConfirmationDialog
- open={isDeleteDialogOpen}
- icon={<FontAwesomeIcon icon={faVideo} />}
- title="Delete Cap"
- description={`Are you sure you want to delete the cap "${displayTitle}"? This action cannot be undone.`}
- confirmLabel={deleteMutation.isPending ? "Deleting..." : "Delete"}
- confirmVariant="destructive"
- loading={deleteMutation.isPending}
- onConfirm={() => deleteMutation.mutate()}
- onCancel={() => setIsDeleteDialogOpen(false)}
- />
+ {settingsDialogMounted && (
+ <SettingsDialog
+ isOpen={isSettingsDialogOpen}
+ onClose={() => setIsSettingsDialogOpen(false)}
+ capId={data.id}
+ settingsData={data.videoSettings ?? undefined}
+ inheritedSpaceSettings={data.inheritedSpaceSettings}
+ user={user}
+ organizationSettings={data.orgSettings}
+ onSaved={refresh}
+ />
+ )}
+ {passwordDialogMounted && (
+ <PasswordDialog
+ isOpen={isPasswordDialogOpen}
+ onClose={() => setIsPasswordDialogOpen(false)}
+ videoId={data.id}
+ hasPassword={passwordProtected}
+ onPasswordUpdated={handlePasswordUpdated}
+ />
+ )}
+ {deleteDialogMounted && (
+ <DeleteCapDialog
+ open={isDeleteDialogOpen}
+ videoId={data.id}
+ videoTitle={displayTitle}
+ onClose={() => setIsDeleteDialogOpen(false)}
+ />
+ )}
</>
)}
{/* Sits in the page bar above both panes, so the spacing is the bar's
@@ -950,7 +982,7 @@ export const ShareHeader = ({
<div className="flex flex-col text-left">
<p className="text-sm text-gray-12">{data.owner.name}</p>
<p className="text-xs text-gray-10">
- {moment(data.createdAt).fromNow()}
+ {fromNow(data.createdAt)}
{views !== undefined && (
<Suspense fallback={null}>
<ViewCount views={views} />
@@ -1084,20 +1116,10 @@ export const ShareHeader = ({
: "Add password"}
</p>
</DropdownMenuItem>
- <DropdownMenuItem
- onClick={() => duplicateMutation.mutate()}
- disabled={
- duplicateMutation.isPending || data.hasActiveUpload
- }
- className="flex items-center gap-2 rounded-lg"
- >
- <FontAwesomeIcon className="size-3" icon={faCopy} />
- <p className="text-sm text-gray-12">
- {duplicateMutation.isPending
- ? "Duplicating..."
- : "Duplicate Cap"}
- </p>
- </DropdownMenuItem>
+ <DuplicateCapMenuItem
+ videoId={data.id}
+ disabled={data.hasActiveUpload}
+ />
{/* Downloads used to live behind a second dots button next to
the link. There is one "everything else about this Cap"
menu, and this is it. */}
@@ -1198,10 +1220,12 @@ export const ShareHeader = ({
</div>
</div>
</div>
- <UpgradeModal
- open={upgradeModalOpen}
- onOpenChange={setUpgradeModalOpen}
- />
+ {upgradeModalMounted && (
+ <UpgradeModal
+ open={upgradeModalOpen}
+ onOpenChange={setUpgradeModalOpen}
+ />
+ )}
</>
);
};
diff --git a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
index 2ed72e014..cc20e2264 100644
--- a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
+++ b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
@@ -20,20 +20,19 @@ import {
} from "react";
import { finalizeDesktopSegmentsRecording } from "@/actions/video/finalize-desktop-segments";
import { Tooltip } from "@/components/Tooltip";
-import { UpgradeModal } from "@/components/UpgradeModal";
import { isRetryableDesktopSegmentsFinalizationError } from "@/lib/desktop-segments-retryable-errors";
import type { VideoData } from "../types";
import { type CaptionLanguage, useCaptionContext } from "./CaptionContext";
import { scheduleReadyRefresh } from "./deferred-ready-refresh";
-import {
- shouldDeferPlaybackSource,
- shouldReloadPlaybackAfterUploadCompletes,
- useUploadProgress,
-} from "./ProgressCircle";
import {
PreparingVideoOverlay,
RecordingInProgressOverlay,
} from "./RecordingInProgress";
+import {
+ shouldDeferPlaybackSource,
+ shouldReloadPlaybackAfterUploadCompletes,
+ type UploadProgress,
+} from "./upload-progress";
import { formatChaptersAsVTT } from "./utils/transcript-utils";
type CommentWithAuthor = typeof commentsSchema.$inferSelect & {
@@ -53,6 +52,16 @@ const HLSVideoPlayer = dynamic(() =>
import("./HLSVideoPlayer").then((m) => m.HLSVideoPlayer),
);
+// Both ride outside the first paint: the tracker only mounts mid-upload (its
+// RPC client drags the Effect runtime along), and the upgrade modal — which
+// carries the Rive animation runtime — mounts on the first upgrade prompt.
+const UploadProgressTracker = dynamic(() => import("./UploadProgressTracker"), {
+ ssr: false,
+});
+const importUpgradeModal = () =>
+ import("@/components/UpgradeModal").then((m) => m.UpgradeModal);
+const UpgradeModal = dynamic(importUpgradeModal, { ssr: false });
+
type AiGenerationStatus =
| "QUEUED"
| "PROCESSING"
@@ -123,6 +132,13 @@ export const ShareVideo = forwardRef<
};
const [upgradeModalOpen, setUpgradeModalOpen] = useState(false);
+ // Latch, not open-state: once the modal has been requested it stays
+ // mounted so closing still plays its exit animation.
+ const [upgradeModalMounted, setUpgradeModalMounted] = useState(false);
+ const openUpgradeModal = () => {
+ setUpgradeModalMounted(true);
+ setUpgradeModalOpen(true);
+ };
const [subtitleUrl, setSubtitleUrl] = useState<string | null>(null);
const [chaptersUrl, setChaptersUrl] = useState<string | null>(null);
const [commentsData, setCommentsData] = useState<CommentWithAuthor[]>([]);
@@ -134,10 +150,23 @@ export const ShareVideo = forwardRef<
>(null);
const autoFinalizeAttemptedRef = useRef(false);
const pendingReadyRefreshRef = useRef(false);
- const segmentUploadProgress = useUploadProgress(
- data.id,
- data.source.type === "desktopSegments" && (data.hasActiveUpload ?? false),
- );
+ // Mirrors what `useUploadProgress(id, enabled)` returned inline: null when
+ // idle, "fetching" from the first enabled render. The hook itself now lives
+ // in the lazily-mounted tracker so finished videos skip its Effect chunk.
+ const trackUploadProgress =
+ data.source.type === "desktopSegments" && (data.hasActiveUpload ?? false);
+ const [segmentUploadProgress, setSegmentUploadProgress] =
+ useState<UploadProgress | null>(
+ trackUploadProgress ? { status: "fetching" } : null,
+ );
+ useEffect(() => {
+ // Both directions of an enable/disable flip mirror the old inline hook:
+ // tracking starting mid-session reads "fetching" immediately (the lazy
+ // tracker hasn't mounted yet), and stopping reads null.
+ setSegmentUploadProgress(
+ trackUploadProgress ? { status: "fetching" } : null,
+ );
+ }, [trackUploadProgress]);
const { data: transcriptContent, error: transcriptError } = useTranscript(
data.id,
@@ -632,7 +661,10 @@ export const ShareVideo = forwardRef<
className="block"
onClick={(e) => {
e.stopPropagation();
- setUpgradeModalOpen(true);
+ openUpgradeModal();
+ }}
+ onPointerEnter={() => {
+ void importUpgradeModal();
}}
>
<div className="relative">
@@ -649,10 +681,18 @@ export const ShareVideo = forwardRef<
</button>
</div>
)}
- <UpgradeModal
- open={upgradeModalOpen}
- onOpenChange={setUpgradeModalOpen}
- />
+ {trackUploadProgress && (
+ <UploadProgressTracker
+ videoId={data.id}
+ onChange={setSegmentUploadProgress}
+ />
+ )}
+ {upgradeModalMounted && (
+ <UpgradeModal
+ open={upgradeModalOpen}
+ onOpenChange={setUpgradeModalOpen}
+ />
+ )}
</>
);
},
diff --git a/apps/web/app/s/[videoId]/_components/Sidebar.tsx b/apps/web/app/s/[videoId]/_components/Sidebar.tsx
index 89a989144..1716ec58c 100644
--- a/apps/web/app/s/[videoId]/_components/Sidebar.tsx
+++ b/apps/web/app/s/[videoId]/_components/Sidebar.tsx
@@ -3,14 +3,30 @@ import { classNames } from "@cap/utils";
import type { ImageUpload, Video } from "@cap/web-domain";
import clsx from "clsx";
import { AnimatePresence, motion } from "motion/react";
+import dynamic from "next/dynamic";
import { forwardRef, Suspense, useState } from "react";
import type { OrganizationSettings } from "@/app/(org)/dashboard/dashboard-data";
import { useCurrentUser } from "@/app/Layout/AuthContext";
import type { VideoData } from "../types";
import { Activity } from "./tabs/Activity";
-import { Settings } from "./tabs/Settings";
-import { Summary } from "./tabs/Summary";
-import { Transcript } from "./tabs/Transcript";
+
+// Activity is the default tab, so it stays in the entry chunk; the other tabs
+// (and their deps — react-markdown for Summary, the 1000-line transcript view)
+// load when first shown. With SSR on, a non-default initial tab still renders
+// server-side and preloads its own chunk. Hovering a tab button warms its
+// chunk so the click still feels instant.
+const importSummary = () => import("./tabs/Summary");
+const importTranscript = () => import("./tabs/Transcript");
+const Summary = dynamic(() => importSummary().then((m) => m.Summary));
+const Transcript = dynamic(() => importTranscript().then((m) => m.Transcript));
+const Settings = dynamic(() =>
+ import("./tabs/Settings").then((m) => m.Settings),
+);
+
+const prefetchTab = (tabId: string) => {
+ if (tabId === "summary") void importSummary();
+ else if (tabId === "transcript") void importTranscript();
+};
type TabType = "activity" | "transcript" | "summary" | "settings";
@@ -235,6 +251,8 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(
type="button"
key={tab.id}
onClick={() => paginate(tab.id as TabType)}
+ onPointerEnter={() => prefetchTab(tab.id)}
+ onFocus={() => prefetchTab(tab.id)}
className={classNames(
"flex-1 px-5 py-3 text-sm font-medium relative transition-colors duration-200",
"hover:bg-gray-1",
diff --git a/apps/web/app/s/[videoId]/_components/Toolbar.tsx b/apps/web/app/s/[videoId]/_components/Toolbar.tsx
index 88dd2ad32..2a5c6d9b5 100644
--- a/apps/web/app/s/[videoId]/_components/Toolbar.tsx
+++ b/apps/web/app/s/[videoId]/_components/Toolbar.tsx
@@ -1,5 +1,8 @@
import { Button } from "@cap/ui";
-import { Comment } from "@cap/web-domain";
+// type-only on purpose: a value import of @cap/web-domain drags the whole
+// effect runtime (~250 KB gz) into the share page's entry chunk. The branded
+// ids carry no constraints, so plain casts replace `.make()` losslessly.
+import type { Comment } from "@cap/web-domain";
import { AnimatePresence, motion } from "motion/react";
import dynamic from "next/dynamic";
import { startTransition, useEffect, useState } from "react";
@@ -7,7 +10,7 @@ import { newComment } from "@/actions/videos/new-comment";
import { useCurrentUser } from "@/app/Layout/AuthContext";
import type { CommentType } from "../Share";
import type { VideoData } from "../types";
-import { AuthOverlay } from "./AuthOverlay";
+import { AuthOverlay } from "./AuthOverlayLazy";
import { RecordActionButtons } from "./media-comment/record-actions";
import type { RecordIntentKind } from "./timeline/TimelineComposer";
@@ -88,14 +91,14 @@ export const Toolbar = ({
? null
: videoElement?.currentTime || 0;
const optimisticComment: CommentType = {
- id: Comment.CommentId.make(`temp-${Date.now()}`),
+ id: (`temp-${Date.now()}` as Comment.CommentId),
authorId: user.id,
authorName: user.name,
authorImage: user.imageUrl,
content: emoji,
createdAt: new Date(),
videoId: data.id,
- parentCommentId: Comment.CommentId.make(""),
+ parentCommentId: ("" as Comment.CommentId),
type: "emoji",
timestamp: currentTime,
updatedAt: new Date(),
@@ -112,7 +115,7 @@ export const Toolbar = ({
content: emoji,
videoId: data.id,
authorImage: user.imageUrl,
- parentCommentId: Comment.CommentId.make(""),
+ parentCommentId: ("" as Comment.CommentId),
type: "emoji",
timestamp: currentTime,
});
@@ -136,14 +139,14 @@ export const Toolbar = ({
? null
: videoElement?.currentTime || 0;
const optimisticComment: CommentType = {
- id: Comment.CommentId.make(`temp-${Date.now()}`),
+ id: (`temp-${Date.now()}` as Comment.CommentId),
authorId: user.id,
authorName: user.name,
authorImage: user.imageUrl,
content: comment,
createdAt: new Date(),
videoId: data.id,
- parentCommentId: Comment.CommentId.make(""),
+ parentCommentId: ("" as Comment.CommentId),
type: "text",
timestamp: currentTime,
updatedAt: new Date(),
@@ -160,7 +163,7 @@ export const Toolbar = ({
content: comment,
videoId: data.id,
authorImage: user.imageUrl,
- parentCommentId: Comment.CommentId.make(""),
+ parentCommentId: ("" as Comment.CommentId),
type: "text",
timestamp: currentTime,
});
diff --git a/apps/web/app/s/[videoId]/_components/media-comment/VideoCommentCard.tsx b/apps/web/app/s/[videoId]/_components/media-comment/VideoCommentCard.tsx
index e66d221f7..f78901b75 100644
--- a/apps/web/app/s/[videoId]/_components/media-comment/VideoCommentCard.tsx
+++ b/apps/web/app/s/[videoId]/_components/media-comment/VideoCommentCard.tsx
@@ -1,9 +1,9 @@
"use client";
import { motion } from "motion/react";
+import dynamic from "next/dynamic";
import { useCallback, useEffect, useRef, useState } from "react";
import { commentMediaUrl } from "@/lib/comment-media";
-import { CommentMiniPlayer } from "./CommentMiniPlayer";
import { formatMediaDuration } from "./format-media-duration";
import type { MediaComment } from "./media-comment-types";
import {
@@ -13,6 +13,14 @@ import {
} from "./media-playback-registry";
import { UploadProgressIndicator } from "./UploadProgressIndicator";
+// Only mounts once a viewer expands a video comment, and it carries the
+// shared media-player primitives (media-chrome and friends) — lazy so the
+// comment list itself doesn't put them in the entry chunk.
+const CommentMiniPlayer = dynamic(
+ () => import("./CommentMiniPlayer").then((m) => m.CommentMiniPlayer),
+ { ssr: false },
+);
+
const FilmGlyph = () => (
<svg
width="20"
diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx
index 54752906a..9fa8e40fb 100644
--- a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx
+++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx
@@ -1,4 +1,7 @@
-import { Comment, User, type Video } from "@cap/web-domain";
+// type-only on purpose: a value import of @cap/web-domain drags the whole
+// effect runtime (~250 KB gz) into the share page's entry chunk. The branded
+// ids carry no constraints, so plain casts replace `.make()` losslessly.
+import type { Comment, User, Video } from "@cap/web-domain";
import { faCommentSlash } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useSearchParams } from "next/navigation";
@@ -86,14 +89,14 @@ export const Comments = Object.assign(
const currentTime = videoElement?.currentTime || 0;
const optimisticComment: CommentType = {
- id: Comment.CommentId.make(`temp-${Date.now()}`),
- authorId: User.UserId.make(user.id),
+ id: (`temp-${Date.now()}` as Comment.CommentId),
+ authorId: (user.id as User.UserId),
authorName: user?.name,
authorImage: user.imageUrl,
content,
createdAt: new Date(),
videoId: props.videoId,
- parentCommentId: Comment.CommentId.make(""),
+ parentCommentId: ("" as Comment.CommentId),
type: "text",
timestamp: currentTime,
updatedAt: new Date(),
@@ -112,7 +115,7 @@ export const Comments = Object.assign(
content,
videoId: props.videoId,
authorImage: user.imageUrl,
- parentCommentId: Comment.CommentId.make(""),
+ parentCommentId: ("" as Comment.CommentId),
type: "text",
timestamp: currentTime,
});
@@ -134,7 +137,7 @@ export const Comments = Object.assign(
: replyingTo;
const optimisticReply: CommentType = {
- id: Comment.CommentId.make(`temp-reply-${Date.now()}`),
+ id: (`temp-reply-${Date.now()}` as Comment.CommentId),
authorId: user.id,
authorName: user.name,
authorImage: user.imageUrl,
diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx
index 696454853..eeda00ea9 100644
--- a/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx
+++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx
@@ -6,7 +6,7 @@ import { forwardRef, type JSX, Suspense, useState } from "react";
import { CapCardAnalytics } from "@/app/(org)/dashboard/caps/components/CapCard/CapCardAnalytics";
import { useCurrentUser } from "@/app/Layout/AuthContext";
import type { CommentType } from "../../../Share";
-import { AuthOverlay } from "../../AuthOverlay";
+import { AuthOverlay } from "../../AuthOverlayLazy";
import Analytics from "./Analytics";
import { Comments } from "./Comments";
diff --git a/apps/web/app/s/[videoId]/_components/timeline/TimelineComposer.tsx b/apps/web/app/s/[videoId]/_components/timeline/TimelineComposer.tsx
index 2bbca8b42..d50017fe2 100644
--- a/apps/web/app/s/[videoId]/_components/timeline/TimelineComposer.tsx
+++ b/apps/web/app/s/[videoId]/_components/timeline/TimelineComposer.tsx
@@ -6,7 +6,7 @@ import { startTransition, useEffect, useState } from "react";
import { newComment } from "@/actions/videos/new-comment";
import { useCurrentUser } from "@/app/Layout/AuthContext";
import type { CommentType } from "../../Share";
-import { AuthOverlay } from "../AuthOverlay";
+import { AuthOverlay } from "../AuthOverlayLazy";
import { MicGlyph } from "./TimelineBranch";
import { useTimelineActions, useTimelineState } from "./TimelineProvider";
import {