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.

Use comma for tagId array delimiter

Tim Wilson70cf48c7e540
diff --git a/apps/web/app/api/route.ts b/apps/web/app/api/route.ts
index 4aad2a1b4c..be5e4a0d6a 100644
--- a/apps/web/app/api/route.ts
+++ b/apps/web/app/api/route.ts
@@ -65,7 +65,6 @@ export function GET(): NextResponse<OpenAPIV3.Document> {
description: "The tag ID(s) to filter the links by.",
in: "query",
required: false,
- style: "pipeDelimited",
explode: false,
schema: {
oneOf: [
diff --git a/apps/web/lib/api/links.ts b/apps/web/lib/api/links.ts
index 54dde0b2ba..ffe3bd1d46 100644
--- a/apps/web/lib/api/links.ts
+++ b/apps/web/lib/api/links.ts
@@ -48,7 +48,7 @@ export async function getLinksForProject({
userId?: string | null;
showArchived?: boolean;
}): Promise<LinkProps[]> {
- const tagIds = tagId ? tagId.split("|") : [];
+ const tagIds = tagId ? tagId.split(",") : [];
const links = await prisma.link.findMany({
where: {
diff --git a/apps/web/ui/links/link-filters.tsx b/apps/web/ui/links/link-filters.tsx
index aea3008779..b4e96c3b91 100644
--- a/apps/web/ui/links/link-filters.tsx
+++ b/apps/web/ui/links/link-filters.tsx
@@ -277,7 +277,7 @@ const TagsFilter = ({
const [showMore, setShowMore] = useState(false);
const selectedTagIds =
- searchParams?.get("tagId")?.split("|")?.filter(Boolean) ?? [];
+ searchParams?.get("tagId")?.split(",")?.filter(Boolean) ?? [];
const onCheckboxChange = useCallback(
(e: React.ChangeEvent<HTMLInputElement>) => {
diff --git a/packages/ui/src/hooks/use-router-stuff.ts b/packages/ui/src/hooks/use-router-stuff.ts
index 9f819e7215..019d7a8d08 100644
--- a/packages/ui/src/hooks/use-router-stuff.ts
+++ b/packages/ui/src/hooks/use-router-stuff.ts
@@ -28,7 +28,7 @@ export default function useRouterStuff() {
del,
replace,
getNewPath,
- arrayDelimiter = "|",
+ arrayDelimiter = ",",
}: {
set?: Record<string, string | string[]>;
del?: string | string[];