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.

Tweaks from AI review

Tim Wilson26508a24109c
diff --git a/apps/web/app/(ee)/api/partners/[partnerId]/comments/route.ts b/apps/web/app/(ee)/api/partners/[partnerId]/comments/route.ts
index e996e27e04..93fbe5d952 100644
--- a/apps/web/app/(ee)/api/partners/[partnerId]/comments/route.ts
+++ b/apps/web/app/(ee)/api/partners/[partnerId]/comments/route.ts
@@ -1,4 +1,3 @@
-import { DubApiError } from "@/lib/api/errors";
import { getDefaultProgramIdOrThrow } from "@/lib/api/programs/get-default-program-id-or-throw";
import { withWorkspace } from "@/lib/auth";
import { ProgramPartnerCommentSchema } from "@/lib/zod/schemas/programs";
@@ -28,12 +27,6 @@ export const GET = withWorkspace(
},
});
- if (!programEnrollment)
- throw new DubApiError({
- code: "not_found",
- message: "Program enrollment not found.",
- });
-
return NextResponse.json(
z.array(ProgramPartnerCommentSchema).parse(programEnrollment.comments),
);
diff --git a/apps/web/lib/swr/use-partner-comments.ts b/apps/web/lib/swr/use-partner-comments.ts
index 4a3f9a62cd..3ea8362ea7 100644
--- a/apps/web/lib/swr/use-partner-comments.ts
+++ b/apps/web/lib/swr/use-partner-comments.ts
@@ -1,6 +1,7 @@
import { fetcher } from "@dub/utils";
import useSWR, { SWRConfiguration } from "swr";
-import { EnrolledPartnerProps } from "../types";
+import { z } from "zod";
+import { ProgramPartnerCommentSchema } from "../zod/schemas/programs";
import useWorkspace from "./use-workspace";
export function usePartnerComments(
@@ -13,7 +14,9 @@ export function usePartnerComments(
) {
const { id: workspaceId } = useWorkspace();
- const { data, isLoading, error } = useSWR<EnrolledPartnerProps>(
+ const { data, isLoading, error } = useSWR<
+ z.infer<typeof ProgramPartnerCommentSchema>[]
+ >(
workspaceId
? `/api/partners/${partnerId}/comments?${new URLSearchParams({
workspaceId,
diff --git a/packages/ui/src/hooks/use-scroll-progress.ts b/packages/ui/src/hooks/use-scroll-progress.ts
index 7a3258e6ae..b45fcdb05f 100644
--- a/packages/ui/src/hooks/use-scroll-progress.ts
+++ b/packages/ui/src/hooks/use-scroll-progress.ts
@@ -27,7 +27,7 @@ export function useScrollProgress(
? 1
: Math.min(scroll / (scrollSize - clientSize), 1),
);
- }, []);
+ }, [direction]);
const resizeObserverEntry = useResizeObserver(ref);