Skip to content

Commit a201748

Browse files
committed
Two changes
- Hide away error messages when states fail to save in PouchDB (they'll still save) - Save AI Provider and Memory settings to PouchDB
1 parent ddff742 commit a201748

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

CHANGES.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,9 @@
8484

8585
- Add a confirmation dialog for deleting chat messages
8686
- Add an animation for when a user copies a message
87-
- Add support for task items in the Note Editor
87+
- Add support for task items in the Note Editor
88+
89+
## 0.1.6
90+
91+
- Hide away error messages when states fail to save in PouchDB (they'll still save)
92+
- Save AI Provider and Memory settings to PouchDB

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/shared/utils/pouchDbPersistence.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@ import { getStorageData, saveStorageData } from './storage';
33
import { debounce } from './debounce';
44
import { chatStateTransform, safeSerialize } from './stateTransforms';
55
import { trpcProxyClient } from '@shared/config';
6-
import { toast } from 'sonner';
7-
86
// Import all state observables
9-
import {
10-
chatsState$,
11-
initializeChats,
12-
} from '@/features/chats/state/chatsState';
7+
import { chatsState$ } from '@/features/chats/state/chatsState';
138
import { smartHubsState$ } from '@/features/smart-hubs/state/smartHubsState';
149
import { defaultPromptsState$ } from '@/features/settings/state/defaultPromptsState';
1510
import { generalSettingsState$ } from '@/features/settings/state/generalSettingsState';
@@ -19,7 +14,6 @@ import {
1914
aiMemorySettings$,
2015
aiSettingsState$,
2116
} from '@src/web/features/settings/state/aiSettings/aiSettingsState';
22-
import { defaultProviders } from '@src/shared/constants';
2317

2418
// Cache for document revisions to handle update conflicts
2519
const documentRevisions: Record<string, string> = {};
@@ -71,11 +65,13 @@ export async function initializePouchDbPersistence(): Promise<void> {
7165

7266
// Set up persistence for other state observables with safe serialization
7367
// Use more aggressive debouncing for states that might change frequently
74-
setupStatePersistence(smartHubsState$, 'smart-hubs-state', 1000);
75-
setupStatePersistence(defaultPromptsState$, 'default-prompts-state', 1500);
76-
setupStatePersistence(generalSettingsState$, 'general-settings-state', 1000);
77-
setupStatePersistence(layoutSettingsState$, 'layout-settings-state', 1000);
78-
setupStatePersistence(promptsLibraryState$, 'prompts-library-state', 1500);
68+
setupStatePersistence(smartHubsState$, 'smart-hubs-state');
69+
setupStatePersistence(defaultPromptsState$, 'default-prompts-state');
70+
setupStatePersistence(generalSettingsState$, 'general-settings-state');
71+
setupStatePersistence(layoutSettingsState$, 'layout-settings-state');
72+
setupStatePersistence(promptsLibraryState$, 'prompts-library-state');
73+
setupStatePersistence(aiSettingsState$, 'ai-settings-state');
74+
setupStatePersistence(aiMemorySettings$, 'ai-memory-settings-state');
7975

8076
// Force load the latest revisions to ensure we have them
8177
await preloadAllRevisions();
@@ -310,12 +306,10 @@ async function saveStateToPouchDb(key: string, value: any): Promise<void> {
310306
}
311307
} catch (retryError) {
312308
console.error(`Failed to resolve conflict for ${docId}:`, retryError);
313-
toast.error(`Failed to save ${key} to database due to conflict`);
314309
throw retryError; // Re-throw to signal failure to the queue
315310
}
316311
} else {
317312
console.error(`Error saving ${key} to PouchDB:`, error);
318-
toast.error(`Failed to save ${key} to database`);
319313
throw error; // Re-throw to signal failure to the queue
320314
}
321315
}

0 commit comments

Comments
 (0)