The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
only load webhooks on the right plan
Steven Teye30a5f240b08
diff --git a/apps/web/lib/swr/use-webhooks.ts b/apps/web/lib/swr/use-webhooks.tsindex 1541ce1d3a..7b75a9e27b 100644--- a/apps/web/lib/swr/use-webhooks.ts+++ b/apps/web/lib/swr/use-webhooks.ts@@ -4,15 +4,21 @@ import useSWR from "swr";import useWorkspace from "./use-workspace";export default function useWebhooks() {- const { id } = useWorkspace();+ const { id, plan } = useWorkspace();const {data: webhooks,isValidating,isLoading,- } = useSWR<WebhookProps[]>(id && `/api/webhooks?workspaceId=${id}`, fetcher, {- dedupingInterval: 60000,- });+ } = useSWR<WebhookProps[]>(+ plan &&+ !["free", "pro"].includes(plan) &&+ `/api/webhooks?workspaceId=${id}`,+ fetcher,+ {+ dedupingInterval: 60000,+ },+ );return {webhooks,diff --git a/apps/web/ui/modals/link-builder/webhook-select.tsx b/apps/web/ui/modals/link-builder/webhook-select.tsxindex 0885e76046..d312eeda91 100644--- a/apps/web/ui/modals/link-builder/webhook-select.tsx+++ b/apps/web/ui/modals/link-builder/webhook-select.tsx@@ -10,7 +10,7 @@ import { LinkFormData } from ".";export function WebhookSelect() {const [isOpen, setIsOpen] = useState(false);const { watch, setValue } = useFormContext<LinkFormData>();- const { webhooks: availableWebhooks, isLoading } = useWebhooks();+ const { webhooks: availableWebhooks } = useWebhooks();useKeyboardShortcut("w", () => setIsOpen(true), { modal: true });const webhookIds = watch("webhookIds") as string[];