From 5e040c062cc21aca54b88108cfc5e616c5685a36 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Wed, 21 Oct 2020 17:22:29 +0100 Subject: [PATCH] Desktop: Fixes #3962: Certain commands no longer worked. --- ElectronClient/gui/MenuBar.tsx | 4 ++-- ReactNativeClient/lib/commands/synchronize.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ElectronClient/gui/MenuBar.tsx b/ElectronClient/gui/MenuBar.tsx index 9a9340e9de..c43d86d06f 100644 --- a/ElectronClient/gui/MenuBar.tsx +++ b/ElectronClient/gui/MenuBar.tsx @@ -138,8 +138,8 @@ function useMenu(props:Props) { const [modulesLastChangeTime, setModulesLastChangeTime] = useState(Date.now()); const onMenuItemClick = useCallback((commandName:string) => { - CommandService.instance().execute(commandName, props.menuItemProps[commandName]); - }, [props.menuItemProps]); + CommandService.instance().execute(commandName); + }, []); const onImportModuleClick = useCallback(async (module:Module, moduleSource:string) => { let path = null; diff --git a/ReactNativeClient/lib/commands/synchronize.ts b/ReactNativeClient/lib/commands/synchronize.ts index 27c48e2310..c9f976b0b5 100644 --- a/ReactNativeClient/lib/commands/synchronize.ts +++ b/ReactNativeClient/lib/commands/synchronize.ts @@ -12,7 +12,9 @@ export const declaration:CommandDeclaration = { // synchronisation depending on the "syncStarted" parameter export const runtime = ():CommandRuntime => { return { - execute: async (_context:CommandContext, syncStarted:boolean = false) => { + execute: async (context:CommandContext, syncStarted:boolean = null) => { + syncStarted = syncStarted === null ? context.state.syncStarted : syncStarted; + const action = syncStarted ? 'cancel' : 'start'; if (!(await reg.syncTarget().isAuthenticated())) {