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 tags & geo bugs

Steven Tey39f541d3a8fd
diff --git a/apps/web/lib/api/links.ts b/apps/web/lib/api/links.ts
index 7ade251cc9..bcfff2df12 100644
--- a/apps/web/lib/api/links.ts
+++ b/apps/web/lib/api/links.ts
@@ -22,6 +22,7 @@ import {
truncate,
validKeyRegex,
} from "@dub/utils";
+import { Prisma } from "@prisma/client";
import cloudinary from "cloudinary";
import { checkIfKeyExists, getRandomKey } from "../planetscale";
import { recordLink } from "../tinybird";
@@ -537,7 +538,7 @@ export async function addLink(link: LinkWithTagIdsProps) {
utm_term,
utm_content,
expiresAt: expiresAt ? new Date(expiresAt) : null,
- geo: geo || undefined,
+ geo: geo || Prisma.JsonNull,
...(combinedTagIds.length > 0 && {
tags: {
createMany: {
@@ -768,7 +769,7 @@ export async function editLink({
utm_term,
utm_content,
expiresAt: expiresAt ? new Date(expiresAt) : null,
- geo: geo || undefined,
+ geo: geo || Prisma.JsonNull,
tags: {
deleteMany: {
tagId: {
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 83d534af5d..5353bb3869 100644
--- a/apps/web/ui/modals/add-edit-link-modal/index.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/index.tsx
@@ -324,8 +324,8 @@ function AddEditLinkModal({
onSubmit={async (e) => {
e.preventDefault();
setSaving(true);
- // @ts-ignore – exclude the extra `user` attribute from `data` object before sending to API
- const { user, tags, ...rest } = data;
+ // @ts-ignore – exclude extra attributes from `data` object before sending to API
+ const { user, tags, tagId, ...rest } = data;
const bodyData = {
...rest,
// Map tags to tagIds