Skip to content

Commit 14919b0

Browse files
committed
fix: sidebar
1 parent 4c0e993 commit 14919b0

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

apps/dashboard/components/layout/organization-selector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function OrganizationSelectorTrigger({
130130
{activeOrganization?.name || "Personal"}
131131
</span>
132132
<Badge
133-
className="shrink-0 text-xs"
133+
className="shrink-0 py-1 text-xs leading-none"
134134
variant={planInfo?.variant || "gray"}
135135
>
136136
{planInfo?.name || "Free"}

apps/dashboard/components/layout/sidebar.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ import { usePathname } from "next/navigation";
88
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
99
import { Button } from "@/components/ui/button";
1010
import { ScrollArea } from "@/components/ui/scroll-area";
11-
import {
12-
useAccordionStates,
13-
usePersistentState,
14-
} from "@/hooks/use-persistent-state";
11+
import { useAccordionStates } from "@/hooks/use-persistent-state";
1512
import { useWebsites } from "@/hooks/use-websites";
1613
import { cn } from "@/lib/utils";
1714
import { CategorySidebar } from "./category-sidebar";
@@ -37,9 +34,9 @@ type NavigationConfig = {
3734
export function Sidebar() {
3835
const pathname = usePathname();
3936
const [isMobileOpen, setIsMobileOpen] = useState(false);
40-
const [selectedCategory, setSelectedCategory] = usePersistentState<
37+
const [selectedCategory, setSelectedCategory] = useState<
4138
string | undefined
42-
>("sidebar-selected-category", undefined);
39+
>(undefined);
4340
const { websites, isLoading: isLoadingWebsites } = useWebsites();
4441
const accordionStates = useAccordionStates();
4542
const sidebarRef = useRef<HTMLDivElement>(null);
@@ -151,6 +148,10 @@ export function Sidebar() {
151148
return () => document.removeEventListener("keydown", handleKeyDown);
152149
}, [isMobileOpen, closeSidebar]);
153150

151+
useEffect(() => {
152+
setSelectedCategory(undefined);
153+
}, [pathname]);
154+
154155
useEffect(() => {
155156
if (isMobileOpen && sidebarRef.current) {
156157
const firstFocusableElement = sidebarRef.current.querySelector(

0 commit comments

Comments
 (0)