| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | import { useAtomValue } from "@effect/atom-react"; |
| 2 | | import { useEffect, useState, type CSSProperties, type ReactNode } from "react"; |
| 3 | | import { useNavigate } from "@tanstack/react-router"; |
| 2 | import { useEffect, useRef, useState, type CSSProperties, type ReactNode } from "react"; |
| 3 | import { useLocation, useNavigate } from "@tanstack/react-router"; |
| 4 | 4 | |
| 5 | 5 | import { isElectron } from "../env"; |
| 6 | 6 | import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings"; |
| ... | ... | @@ -55,6 +55,9 @@ function SidebarControl() { |
| 55 | 55 | |
| 56 | 56 | export function AppSidebarLayout({ children }: { children: ReactNode }) { |
| 57 | 57 | const navigate = useNavigate(); |
| 58 | const pathname = useLocation({ select: (location) => location.pathname }); |
| 59 | const pathnameRef = useRef(pathname); |
| 60 | pathnameRef.current = pathname; |
| 58 | 61 | const isMacosDesktop = isElectron && isMacPlatform(navigator.platform); |
| 59 | 62 | const [isWindowFullscreen, setIsWindowFullscreen] = useState(() => { |
| 60 | 63 | const getWindowFullscreenState = window.desktopBridge?.getWindowFullscreenState; |
| ... | ... | @@ -92,7 +95,10 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) { |
| 92 | 95 | |
| 93 | 96 | const unsubscribe = onMenuAction((action) => { |
| 94 | 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 | }); |
| 98 | 104 | |