The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
move linkIds to getLinksQuerySchemaExtended
Steven Teybaa425cdd45a
diff --git a/apps/web/app/api/links/route.ts b/apps/web/app/api/links/route.tsindex 59f192bbaa..3f3df00f01 100644--- a/apps/web/app/api/links/route.ts+++ b/apps/web/app/api/links/route.ts@@ -29,10 +29,10 @@ export const GET = withWorkspace(page,pageSize,userId,- ids,showArchived,withTags,includeUser,+ linkIds,} = getLinksQuerySchemaExtended.parse(searchParams);if (domain) {@@ -49,10 +49,10 @@ export const GET = withWorkspace(page,pageSize,userId,- ids,showArchived,withTags,includeUser,+ linkIds,});return NextResponse.json(response, {diff --git a/apps/web/lib/api/links/get-links-for-workspace.ts b/apps/web/lib/api/links/get-links-for-workspace.tsindex 2f1993d38a..4ccff8eba3 100644--- a/apps/web/lib/api/links/get-links-for-workspace.ts+++ b/apps/web/lib/api/links/get-links-for-workspace.ts@@ -14,10 +14,10 @@ export async function getLinksForWorkspace({page,pageSize,userId,- ids,showArchived,withTags,includeUser,+ linkIds,}: z.infer<typeof getLinksQuerySchemaExtended> & {workspaceId: string;}) {@@ -61,7 +61,7 @@ export async function getLinksForWorkspace({}: {}),...(userId && { userId }),- ...(ids && { id: { in: ids } }),+ ...(linkIds && { id: { in: linkIds } }),},include: {user: includeUser,diff --git a/apps/web/lib/swr/use-links.ts b/apps/web/lib/swr/use-links.tsindex ef32d681d8..6558fe3e14 100644--- a/apps/web/lib/swr/use-links.ts+++ b/apps/web/lib/swr/use-links.ts@@ -4,10 +4,10 @@ import { useEffect, useState } from "react";import useSWR, { SWRConfiguration } from "swr";import { z } from "zod";import { LinkWithTagsProps, UserProps } from "../types";-import { getLinksQuerySchema } from "../zod/schemas/links";+import { getLinksQuerySchemaExtended } from "../zod/schemas/links";import useWorkspace from "./use-workspace";-const partialQuerySchema = getLinksQuerySchema.partial();+const partialQuerySchema = getLinksQuerySchemaExtended.partial();export default function useLinks(opts: z.infer<typeof partialQuerySchema> = {},diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.tsindex f22d6864ae..cd96138a5a 100644--- a/apps/web/lib/zod/schemas/links.ts+++ b/apps/web/lib/zod/schemas/links.ts@@ -57,11 +57,6 @@ const LinksQuerySchema = z.object({"The search term to filter the links by. The search term will be matched against the short link slug and the destination url.",),userId: z.string().optional().describe("The user ID to filter the links by."),- ids: z- .union([z.string(), z.array(z.string())])- .transform((v) => (Array.isArray(v) ? v : v.split(",")))- .optional()- .describe("Link IDs to filter by."),showArchived: booleanQuerySchema.optional().default("false")@@ -578,8 +573,13 @@ export const getLinkInfoQuerySchema = domainKeySchema.partial().merge(export const getLinksQuerySchemaExtended = getLinksQuerySchema.merge(z.object({- // Only Dub UI uses includeUser query parameter+ // Only Dub UI uses the following query parametersincludeUser: booleanQuerySchema.default("false"),+ linkIds: z+ .union([z.string(), z.array(z.string())])+ .transform((v) => (Array.isArray(v) ? v : v.split(",")))+ .optional()+ .describe("Link IDs to filter by."),}),);diff --git a/apps/web/ui/webhooks/add-edit-webhook-form.tsx b/apps/web/ui/webhooks/add-edit-webhook-form.tsxindex ab460987a7..87fd9a2556 100644--- a/apps/web/ui/webhooks/add-edit-webhook-form.tsx+++ b/apps/web/ui/webhooks/add-edit-webhook-form.tsx@@ -322,7 +322,7 @@ function LinksSelector({);const { links: selectedLinks } = useLinks({- ids: selectedLinkIds,+ linkIds: selectedLinkIds,});const options = useMemo(