The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add "Reset to default" button to OG modal
Tim Wilson4c629cc957d1
diff --git a/apps/web/ui/modals/link-builder/index.tsx b/apps/web/ui/modals/link-builder/index.tsxindex 7b9c189cf1..fb149e1280 100644--- a/apps/web/ui/modals/link-builder/index.tsx+++ b/apps/web/ui/modals/link-builder/index.tsx@@ -248,6 +248,8 @@ function LinkBuilderInner({// Manually reset empty strings to nullexpiredUrl: rest.expiredUrl || null,+ ios: rest.ios || null,+ android: rest.android || null,};try {diff --git a/apps/web/ui/modals/link-builder/og-modal.tsx b/apps/web/ui/modals/link-builder/og-modal.tsxindex 4da45bc475..c70d39d29d 100644--- a/apps/web/ui/modals/link-builder/og-modal.tsx+++ b/apps/web/ui/modals/link-builder/og-modal.tsx@@ -75,7 +75,7 @@ function OGModalInner({},});- const url = watchParent("url");+ const [url, parentProxy] = watchParent(["url", "proxy"]);const { image, title, description } = watch();const { setShowPromptModal, PromptModal } = usePromptModal({@@ -430,7 +430,21 @@ function OGModalInner({</div></div>- <div className="mt-6 flex justify-end">+ <div className="mt-6 flex items-center justify-between">+ <div>+ {parentProxy && (+ <button+ type="button"+ className="text-xs font-medium text-gray-700 transition-colors hover:text-gray-950"+ onClick={() => {+ setValueParent("proxy", false, { shouldDirty: true });+ setShowOGModal(false);+ }}+ >+ Reset to default+ </button>+ )}+ </div><div className="flex items-center gap-2"><Buttontype="button"diff --git a/apps/web/ui/modals/link-builder/use-metatags.ts b/apps/web/ui/modals/link-builder/use-metatags.tsindex 67f2039715..d187c0bbb6 100644--- a/apps/web/ui/modals/link-builder/use-metatags.ts+++ b/apps/web/ui/modals/link-builder/use-metatags.ts@@ -12,7 +12,7 @@ export function useMetatags({enabled: boolean;}) {const { watch, setValue } = useFormContext<LinkFormData>();- const { url, password } = watch();+ const [url, password, proxy] = watch(["url", "password", "proxy"]);const [debouncedUrl] = useDebounce(getUrlWithoutUTMParams(url), 500);const [generatingMetatags, setGeneratingMetatags] = useState(initial);@@ -36,7 +36,7 @@ export function useMetatags({* - custom OG proxy is not enabled* - url is not empty**/- if (enabled) {+ if (enabled && !proxy) {setValue("title", null);setValue("description", null);setValue("image", null);@@ -59,7 +59,7 @@ export function useMetatags({} else {setGeneratingMetatags(false);}- }, [debouncedUrl, password, enabled]);+ }, [debouncedUrl, password, proxy, enabled]);return { generatingMetatags };}