From 3420374649abf267388eba2c07006fe651e43a4a Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Fri, 2 Jan 2026 11:31:59 +0800 Subject: [PATCH] fix: toggling right pane visibility incorrectly affects all windows --- apps/client/src/widgets/buttons/right_pane_toggle.tsx | 6 +++--- apps/client/src/widgets/sidebar/RightPanelContainer.tsx | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/client/src/widgets/buttons/right_pane_toggle.tsx b/apps/client/src/widgets/buttons/right_pane_toggle.tsx index 8f82e9de0..6a31d633c 100644 --- a/apps/client/src/widgets/buttons/right_pane_toggle.tsx +++ b/apps/client/src/widgets/buttons/right_pane_toggle.tsx @@ -3,15 +3,15 @@ import clsx from "clsx"; import { t } from "../../services/i18n"; import options from "../../services/options"; import ActionButton from "../react/ActionButton"; -import { useState } from "preact/hooks"; +import { useState, useCallback } from "preact/hooks"; import { useTriliumEvent } from "../react/hooks"; export default function RightPaneToggle() { const [ rightPaneVisible, setRightPaneVisible ] = useState(options.is("rightPaneVisible")); - useTriliumEvent("toggleRightPane", () => { + useTriliumEvent("toggleRightPane", useCallback(() => { setRightPaneVisible(current => !current); - }); + }, [])); return ( { + useTriliumEvent("toggleRightPane", useCallback(() => { setRightPaneVisible(current => { const newValue = !current; options.save("rightPaneVisible", newValue.toString()); return newValue; }); - }); + }, [])); return (