Compare commits

...

3 Commits

Author SHA1 Message Date
Cursor Agent
6debbf77b6 [AI] Remove temporary screenshots
Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>
2026-02-26 20:16:19 +00:00
Cursor Agent
235535a68f [AI] Add notification screenshots for PR review
Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>
2026-02-26 20:15:55 +00:00
Cursor Agent
358549bdd4 [AI] Show sync performance notification when message count exceeds 20k
- Add messageCount to sync success event type
- Count messages_crdt rows after successful sync on the server
- Show dismissible info notification with 'Reset sync' button when >20k messages
- Persist dismissal state in localStorage (budget-scoped) so it doesn't reappear
- Add flags.syncPerformanceNotificationDismissed to LocalPrefs type

Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>
2026-02-25 23:10:20 +00:00
4 changed files with 46 additions and 0 deletions

View File

@@ -59,6 +59,42 @@ export function listenForSyncEvent(store: AppStore, queryClient: QueryClient) {
);
}
if (
event.type === 'success' &&
event.messageCount != null &&
event.messageCount > 20000
) {
const budgetId = prefs?.id;
const dismissedKey = `${budgetId}-flags.syncPerformanceNotificationDismissed`;
const dismissed = localStorage.getItem(dismissedKey);
if (!dismissed || dismissed !== 'true') {
store.dispatch(
addNotification({
notification: {
type: 'message',
title: t('Sync performance issue'),
message: t(
'Your budget has {{messageCount}} sync messages which may cause slow performance. Resetting sync will clear old messages and speed things up.',
{ messageCount: event.messageCount.toLocaleString() },
),
sticky: true,
id: 'sync-performance',
button: {
title: t('Reset sync'),
action: () => {
void store.dispatch(resetSync());
},
},
onClose: () => {
localStorage.setItem(dismissedKey, JSON.stringify(true));
},
},
}),
);
}
}
const tables = event.tables;
if (tables.includes('prefs')) {

View File

@@ -638,10 +638,18 @@ export const fullSync = once(async function (): Promise<
const tables = getTablesFromMessages(messages);
const messageCountResult = db.runQuery<{ count: number }>(
'SELECT COUNT(*) as count FROM messages_crdt',
[],
true,
);
const messageCount = messageCountResult[0]?.count ?? 0;
app.events.emit('sync', {
type: 'success',
tables,
syncDisabled: checkSyncingMode('disabled'),
messageCount,
});
return { messages };
});

View File

@@ -80,6 +80,7 @@ export type LocalPrefs = Partial<{
'budget.showHiddenCategories': boolean;
'budget.startMonth': string;
'flags.updateNotificationShownForVersion': string;
'flags.syncPerformanceNotificationDismissed': boolean;
'schedules.showCompleted': boolean;
reportsViewLegend: boolean;
reportsViewSummary: boolean;

View File

@@ -30,6 +30,7 @@ type SyncEvent = {
type: 'success';
tables: string[];
syncDisabled?: boolean;
messageCount?: number;
}
| {
type: 'error';