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.

fix

Steven Tey6a1643e49320
diff --git a/apps/web/ui/modals/add-edit-link-modal/index.tsx b/apps/web/ui/modals/add-edit-link-modal/index.tsx
index 369e2ee58c..62ef98f8ac 100644
--- a/apps/web/ui/modals/add-edit-link-modal/index.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/index.tsx
@@ -88,16 +88,18 @@ function AddEditLinkModal({
} = useDomains();
const [data, setData] = useState<LinkWithTagsProps>(
- props ||
- duplicateProps || {
- ...(DEFAULT_LINK_PROPS as LinkWithTagsProps),
- domain: primaryDomain,
- key: "",
- url: "",
- tags: [],
- },
+ props || duplicateProps || DEFAULT_LINK_PROPS,
);
+ useEffect(() => {
+ if (primaryDomain) {
+ setData((prev) => ({
+ ...prev,
+ domain: primaryDomain,
+ }));
+ }
+ }, [primaryDomain]);
+
const { domain, key, url, password, proxy } = data;
const [debouncedKey] = useDebounce(key, 500);
diff --git a/packages/utils/src/constants/misc.ts b/packages/utils/src/constants/misc.ts
index f2fc9a2e0f..7484b26154 100644
--- a/packages/utils/src/constants/misc.ts
+++ b/packages/utils/src/constants/misc.ts
@@ -1,4 +1,4 @@
-export const DEFAULT_LINK_PROPS = {
+export const DEFAULT_LINK_PROPS: any = {
key: "",
url: "",
domain: "",
@@ -17,6 +17,7 @@ export const DEFAULT_LINK_PROPS = {
userId: "",
proxy: false,
+ tags: [],
};
export const GOOGLE_FAVICON_URL =