1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-12 08:54:00 +02:00

Desktop: Fixes #3962: Certain commands no longer worked.

This commit is contained in:
Laurent Cozic 2020-10-21 17:22:29 +01:00
parent 0cede5f90a
commit 5e040c062c
2 changed files with 5 additions and 3 deletions

View File

@ -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;

View File

@ -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())) {