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.

remove force-static

Steven Teyb403a43256a6
diff --git a/apps/web/app/admin.dub.co/(dashboard)/layout.tsx b/apps/web/app/admin.dub.co/(dashboard)/layout.tsx
index 8858a8753f..0bdbdb1e8a 100644
--- a/apps/web/app/admin.dub.co/(dashboard)/layout.tsx
+++ b/apps/web/app/admin.dub.co/(dashboard)/layout.tsx
@@ -4,7 +4,6 @@ import Providers from "app/providers";
import Link from "next/link";
import { ReactNode } from "react";
-export const dynamic = "force-static";
export const metadata = constructMetadata({ noIndex: true });
const tabs = [
diff --git a/apps/web/app/app.dub.co/(dashboard)/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/layout.tsx
index b5361a442d..6a6d208aac 100644
--- a/apps/web/app/app.dub.co/(dashboard)/layout.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/layout.tsx
@@ -5,7 +5,6 @@ import { constructMetadata } from "@dub/utils";
import { ReactNode } from "react";
import Providers from "../../providers";
-export const dynamic = "force-static";
export const metadata = constructMetadata();
export default async function Layout({ children }: { children: ReactNode }) {
diff --git a/apps/web/ui/layout/sidebar/sidebar-nav.tsx b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
index 58d26f5c22..ec5e075718 100644
--- a/apps/web/ui/layout/sidebar/sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
@@ -8,7 +8,6 @@ import {
PropsWithChildren,
ReactNode,
Suspense,
- useEffect,
useMemo,
useState,
} from "react";
@@ -109,13 +108,12 @@ function NavItem({ item }: { item: NavItemType }) {
const { name, icon: Icon, href, exact } = item;
const [hovered, setHovered] = useState(false);
- const [isActive, setIsActive] = useState(false);
const pathname = usePathname();
- useEffect(() => {
- setIsActive(exact ? pathname === href : pathname.startsWith(href));
- }, [exact, pathname, href]);
+ const isActive = useMemo(() => {
+ return pathname === href || (exact && pathname.startsWith(href));
+ }, [pathname, href, exact]);
return (
<Link