fix: auto-provision theme files on vault open for any vault
seed_vault_themes now writes individual missing/empty files instead of skipping when the theme/ directory already exists. A new ensure_vault_themes Tauri command is called by useThemeManager on every vault open so vaults without a theme/ folder get default.md and dark.md seeded automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -478,4 +478,17 @@ describe('useThemeManager', () => {
|
||||
// Light theme isDark should be false (default state is false, so this is stable)
|
||||
expect(result.current.isDark).toBe(false)
|
||||
})
|
||||
|
||||
it('calls ensure_vault_themes on mount with vaultPath', async () => {
|
||||
renderHook(() => useThemeManager('/vault', entries, allContent))
|
||||
await waitFor(() => {
|
||||
expect(mockInvokeFn).toHaveBeenCalledWith('ensure_vault_themes', { vaultPath: '/vault' })
|
||||
})
|
||||
})
|
||||
|
||||
it('does not call ensure_vault_themes when vaultPath is null', async () => {
|
||||
renderHook(() => useThemeManager(null, entries, allContent))
|
||||
await new Promise(r => setTimeout(r, 50))
|
||||
expect(mockInvokeFn).not.toHaveBeenCalledWith('ensure_vault_themes', expect.anything())
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user