authorgravatar for 105842516+jamesx0416@users.noreply.github.comJames <105842516+jamesx0416@users.noreply.github.com> 2026-07-18 07:20:28+10:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-07-17 23:20:28+02:00
log143b9c9280015f0ff9fa70cd9e4edb18e975c94d
treebb8078f717450c44655a7c9cae035e8145862f6a
parentcf58cadd027f013b5b0f95693975d226d9fd178f
signature Signed by PGP key B5690EEEBB952194

fix(ux): spamming cmd + , no longer stack opening settings (#2757)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

1 files changed, 9 insertions(+), 3 deletions(-)

apps/web/src/components/AppSidebarLayout.tsx+9-3
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1import { useAtomValue } from "@effect/atom-react";1import { useAtomValue } from "@effect/atom-react";
2import { useEffect, useState, type CSSProperties, type ReactNode } from "react";2import { useEffect, useRef, useState, type CSSProperties, type ReactNode } from "react";
3import { useNavigate } from "@tanstack/react-router";3import { useLocation, useNavigate } from "@tanstack/react-router";
44
5import { isElectron } from "../env";5import { isElectron } from "../env";
6import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings";6import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings";
...@@ -55,6 +55,9 @@ function SidebarControl() {...@@ -55,6 +55,9 @@ function SidebarControl() {
5555
56export function AppSidebarLayout({ children }: { children: ReactNode }) {56export function AppSidebarLayout({ children }: { children: ReactNode }) {
57 const navigate = useNavigate();57 const navigate = useNavigate();
58 const pathname = useLocation({ select: (location) => location.pathname });
59 const pathnameRef = useRef(pathname);
60 pathnameRef.current = pathname;
58 const isMacosDesktop = isElectron && isMacPlatform(navigator.platform);61 const isMacosDesktop = isElectron && isMacPlatform(navigator.platform);
59 const [isWindowFullscreen, setIsWindowFullscreen] = useState(() => {62 const [isWindowFullscreen, setIsWindowFullscreen] = useState(() => {
60 const getWindowFullscreenState = window.desktopBridge?.getWindowFullscreenState;63 const getWindowFullscreenState = window.desktopBridge?.getWindowFullscreenState;
...@@ -92,7 +95,10 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {...@@ -92,7 +95,10 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
9295
93 const unsubscribe = onMenuAction((action) => {96 const unsubscribe = onMenuAction((action) => {
94 if (action === "open-settings") {97 if (action === "open-settings") {
95 void navigate({ to: "/settings" });98 const isSettingsRoute = /^\/settings(\/|$)/.test(pathnameRef.current);
99 if (!isSettingsRoute) {
100 void navigate({ to: "/settings" });
101 }
96 }102 }
97 });103 });
98104