Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

perf(web): defer pricing card Rive art until visible

Richie McIlroy32b88592792b
diff --git a/apps/web/components/pages/HomePage/Pricing/CommercialCard.tsx b/apps/web/components/pages/HomePage/Pricing/CommercialCard.tsx
index f73a5eb63..2bf0877c5 100644
--- a/apps/web/components/pages/HomePage/Pricing/CommercialCard.tsx
+++ b/apps/web/components/pages/HomePage/Pricing/CommercialCard.tsx
@@ -8,6 +8,7 @@ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import { useRef, useState } from "react";
import { toast } from "sonner";
import { Tooltip } from "@/components/Tooltip";
+import { WhenVisible } from "@/components/ui/WhenVisible";
import { homepageCopy } from "../../../../data/homepage-copy";
import { BillingToggle } from "./BillingToggle";
import { CommercialArt, type CommercialArtRef } from "./CommercialArt";
@@ -65,7 +66,9 @@ export const CommercialCard = () => {
className="flex flex-col p-8 rounded-2xl border bg-gray-1 border-gray-5"
>
<div className="mb-4 size-14 -ml-3">
- <CommercialArt ref={artRef} />
+ <WhenVisible className="size-full">
+ <CommercialArt ref={artRef} />
+ </WhenVisible>
</div>
<div className="flex gap-1.5 items-center">
<h3 className="text-lg font-semibold text-gray-12">{copy.title}</h3>
diff --git a/apps/web/components/pages/HomePage/Pricing/ProCard.tsx b/apps/web/components/pages/HomePage/Pricing/ProCard.tsx
index dac62cda2..fc5764bb0 100644
--- a/apps/web/components/pages/HomePage/Pricing/ProCard.tsx
+++ b/apps/web/components/pages/HomePage/Pricing/ProCard.tsx
@@ -6,6 +6,7 @@ import { useMutation } from "@tanstack/react-query";
import { useRef, useState } from "react";
import { toast } from "sonner";
import { useStripeContext } from "@/app/Layout/StripeContext";
+import { WhenVisible } from "@/components/ui/WhenVisible";
import { homepageCopy } from "../../../../data/homepage-copy";
import { BillingToggle } from "./BillingToggle";
import { PlanFeature } from "./PlanFeature";
@@ -90,7 +91,9 @@ export const ProCard = () => {
</span>
<div className="mb-4 size-14 -ml-3">
- <ProArt ref={artRef} />
+ <WhenVisible className="size-full">
+ <ProArt ref={artRef} />
+ </WhenVisible>
</div>
<h3 className="text-lg font-semibold text-gray-12">{copy.title}</h3>
<p className="mt-1.5 text-sm leading-relaxed text-gray-10 min-h-[40px]">