Skip to content

Commit 5cdcd79

Browse files
committed
Merge branch 'menu-bar-click'
2 parents 18a0cfa + 2b8b8b8 commit 5cdcd79

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/App.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,6 +2826,9 @@ function App() {
28262826

28272827
// The action system hook
28282828
const actions = useActions(actionContext, actionHandlers);
2829+
// Ref for menu listener to avoid re-subscribing on every actions change
2830+
const executeByMenuIdRef = useRef(actions.executeByMenuId);
2831+
executeByMenuIdRef.current = actions.executeByMenuId;
28292832

28302833
// Context-aware action handlers (new system)
28312834
const contextActionHandlers = useMemo(() => createActionHandlers({
@@ -3059,6 +3062,7 @@ function App() {
30593062
}, []);
30603063

30613064
// Listen for menu bar actions from the backend
3065+
// Uses a ref to avoid re-subscribing on every actions change (which caused multiple listeners)
30623066
useEffect(() => {
30633067
const unlistenMenu = listen<string>('menu-action', (event) => {
30643068
// When a picker is open, ignore menu actions (except picker toggles handled via keyboard)
@@ -3067,13 +3071,13 @@ function App() {
30673071
}
30683072
// Use the action system to execute menu actions
30693073
// The action system handles availability checking internally
3070-
actions.executeByMenuId(event.payload);
3074+
executeByMenuIdRef.current(event.payload);
30713075
});
30723076

30733077
return () => {
30743078
unlistenMenu.then((fn) => fn());
30753079
};
3076-
}, [actions]);
3080+
}, []);
30773081

30783082
// Sync action availability to menu bar
30793083
useEffect(() => {

0 commit comments

Comments
 (0)