Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

set noindex to true if target is set

Steven Tey9faf3b28a04a
diff --git a/apps/web/ui/modals/add-edit-domain-modal/index.tsx b/apps/web/ui/modals/add-edit-domain-modal/index.tsx
index 71a9fb9da2..ddfb6aaa2c 100644
--- a/apps/web/ui/modals/add-edit-domain-modal/index.tsx
+++ b/apps/web/ui/modals/add-edit-domain-modal/index.tsx
@@ -22,6 +22,7 @@ import {
Dispatch,
SetStateAction,
useCallback,
+ useEffect,
useMemo,
useState,
} from "react";
@@ -60,6 +61,14 @@ function AddEditDomainModal({
const { slug: domain, target, type, placeholder, expiredUrl } = data;
+ // set noindex to true if target is set
+ useEffect(() => {
+ setData((prev) => ({
+ ...prev,
+ noindex: target ? true : false,
+ }));
+ }, [target]);
+
const [lockDomain, setLockDomain] = useState(true);
const [saving, setSaving] = useState(false);
const [domainError, setDomainError] = useState<string | null>(null);