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.

Address CodeRabbit feedback

Steven Tey023925f9f23b
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/events/title-link.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/events/title-link.tsx
index 5d45ce3069..fd71dffb18 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/events/title-link.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/events/title-link.tsx
@@ -15,7 +15,7 @@ export default function ProgramEventsPageTitleLink() {
Analytics
</Link>
<ChevronRight className="text-content-muted size-2.5 shrink-0 [&_*]:stroke-2" />
- <h1>Events</h1>
+ Events
</div>
);
}
diff --git a/apps/web/ui/analytics/use-analytics-query.tsx b/apps/web/ui/analytics/use-analytics-query.tsx
index 03b394e9b2..4f9a8b3287 100644
--- a/apps/web/ui/analytics/use-analytics-query.tsx
+++ b/apps/web/ui/analytics/use-analytics-query.tsx
@@ -89,7 +89,8 @@ export function useAnalyticsQuery({
...(customerId && { customerId }),
...(root && { root: root.toString() }),
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
- ...(product === "program" && { programId: defaultProgramId }),
+ ...(product === "program" &&
+ defaultProgramId && { programId: defaultProgramId }),
}).toString();
}, [
searchParams,
diff --git a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
index 4aefed4d25..7977aa9af4 100644
--- a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
@@ -332,12 +332,12 @@ const NAV_AREAS: SidebarNavAreas<SidebarNavData> = {
{
name: "Analytics",
icon: LinesY,
- href: `/${slug}/links/analytics${pathname === `/${slug}/analytics` ? "" : queryString}`,
+ href: `/${slug}/links/analytics${pathname === `/${slug}/links/analytics` ? "" : queryString}`,
},
{
name: "Events",
icon: CursorRays,
- href: `/${slug}/links/events${pathname === `/${slug}/events` ? "" : queryString}`,
+ href: `/${slug}/links/events${pathname === `/${slug}/links/events` ? "" : queryString}`,
},
{
name: "Customers",
diff --git a/packages/ui/src/hooks/use-current-product.ts b/packages/ui/src/hooks/use-current-product.ts
index 90ef32abda..aa626a03b8 100644
--- a/packages/ui/src/hooks/use-current-product.ts
+++ b/packages/ui/src/hooks/use-current-product.ts
@@ -1,17 +1,14 @@
import { usePathname } from "next/navigation";
-import { useEffect, useState } from "react";
+import { useMemo } from "react";
export function useCurrentProduct() {
const pathname = usePathname();
- const [product, setProduct] = useState<"links" | "program" | null>(null);
- useEffect(() => {
+ const product = useMemo<"links" | "program" | null>(() => {
const productParam = pathname.split("/")[2];
- if (productParam === "links") {
- setProduct("links");
- } else if (productParam === "program") {
- setProduct("program");
- }
+ if (productParam === "links") return "links";
+ if (productParam === "program") return "program";
+ return null;
}, [pathname]);
return { product };