| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | import { useAtomValue } from "@effect/atom-react"; | 1 | import { useAtomValue } from "@effect/atom-react"; |
| 2 | import { useEffect, useState, type CSSProperties, type ReactNode } from "react"; | 2 | import { useEffect, useRef, useState, type CSSProperties, type ReactNode } from "react"; |
| 3 | import { useNavigate } from "@tanstack/react-router"; | 3 | import { useLocation, useNavigate } from "@tanstack/react-router"; |
| 4 | | 4 | |
| 5 | import { isElectron } from "../env"; | 5 | import { isElectron } from "../env"; |
| 6 | import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings"; | 6 | import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings"; |
| ... | @@ -55,6 +55,9 @@ function SidebarControl() { | ... | @@ -55,6 +55,9 @@ function SidebarControl() { |
| 55 | | 55 | |
| 56 | export function AppSidebarLayout({ children }: { children: ReactNode }) { | 56 | export 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 }) { |
| 92 | | 95 | |
| 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 | }); |
| 98 | | 104 | |