mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	electron: Fix initial sync (closes #284)
Apparently the issue was caused by options_init which for Electron was attempting to read the theme asynchronously. That's why it didn't cause issues on the server build.
This commit is contained in:
		| @@ -16,7 +16,7 @@ interface NotSyncedOpts { | ||||
|     syncProxy?: string; | ||||
| } | ||||
|  | ||||
| async function initNotSyncedOptions(initialized: boolean, opts: NotSyncedOpts = {}) { | ||||
| async function initNotSyncedOptions(initialized: boolean, theme: string, opts: NotSyncedOpts = {}) { | ||||
|     optionService.createOption('openNoteContexts', JSON.stringify([ | ||||
|         { | ||||
|             notePath: 'root', | ||||
| @@ -32,15 +32,7 @@ async function initNotSyncedOptions(initialized: boolean, opts: NotSyncedOpts = | ||||
|     optionService.createOption('initialized', initialized ? 'true' : 'false', false); | ||||
|  | ||||
|     optionService.createOption('lastSyncedPull', '0', false); | ||||
|     optionService.createOption('lastSyncedPush', '0', false); | ||||
|  | ||||
|     let theme = 'dark'; // default based on the poll in https://github.com/zadam/trilium/issues/2516 | ||||
|  | ||||
|     if (utils.isElectron()) { | ||||
|         const {nativeTheme} = await import("electron"); | ||||
|  | ||||
|         theme = nativeTheme.shouldUseDarkColors ? 'dark' : 'light'; | ||||
|     } | ||||
|     optionService.createOption('lastSyncedPush', '0', false);     | ||||
|  | ||||
|     optionService.createOption('theme', theme, false); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user