Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

fix: prevent redundant site navigation in SiteSelector component

Bill Yangbcc5fb09349e
diff --git a/client/src/app/[site]/components/Sidebar/SiteSelector.tsx b/client/src/app/[site]/components/Sidebar/SiteSelector.tsx
index 951ff8516..a4f6050c3 100644
--- a/client/src/app/[site]/components/Sidebar/SiteSelector.tsx
+++ b/client/src/app/[site]/components/Sidebar/SiteSelector.tsx
@@ -27,10 +27,14 @@ function SiteSelectorContent() {
<DropdownMenuItem
key={site.siteId}
onClick={() => {
+ if (isSelected) return;
resetStore();
router.push(`/${site.siteId}`);
}}
- className={cn("flex items-center justify-between", isSelected && "bg-neutral-800")}
+ className={cn(
+ "flex items-center justify-between",
+ isSelected && "bg-neutral-800"
+ )}
>
<div className="flex items-center gap-2">
<Favicon domain={site.domain} className="w-4 h-4" />