The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix the tag
Kiran K0670767690ba
diff --git a/apps/web/app/api/links/upsert/route.ts b/apps/web/app/api/links/upsert/route.tsindex a0e0035f35..d01497d857 100644--- a/apps/web/app/api/links/upsert/route.ts+++ b/apps/web/app/api/links/upsert/route.ts@@ -24,19 +24,6 @@ export const PUT = withWorkspace(projectId: workspace.id,url: body.url,},- include: {- tags: {- select: {- tag: {- select: {- id: true,- name: true,- color: true,- },- },- },- },- },});if (link) {@@ -48,13 +35,36 @@ export const PUT = withWorkspace(? link.expiresAt.toISOString(): link.expiresAt,geo: link.geo as NewLinkProps["geo"],- tagIds: (link.tags || []).map(({ tag }) => tag.id),...body,};// if link and updatedLink are identical, return the linkif (deepEqual(link, updatedLink)) {- return NextResponse.json(transformLink(link), { headers });+ const tags = await prisma.tag.findMany({+ where: {+ links: {+ some: {+ linkId: link.id,+ },+ },+ },+ select: {+ id: true,+ name: true,+ color: true,+ },+ });++ const response = transformLink({+ ...link,+ tags: tags.map((tag) => ({+ tag,+ })),+ });++ return NextResponse.json(response, {+ headers,+ });}if (updatedLink.projectId !== link?.projectId) {