mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-09 11:42:54 -05:00
Compare commits
3 Commits
claude/ana
...
cursor/syn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6debbf77b6 | ||
|
|
235535a68f | ||
|
|
358549bdd4 |
@@ -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')) {
|
||||
|
||||
@@ -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 };
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -30,6 +30,7 @@ type SyncEvent = {
|
||||
type: 'success';
|
||||
tables: string[];
|
||||
syncDisabled?: boolean;
|
||||
messageCount?: number;
|
||||
}
|
||||
| {
|
||||
type: 'error';
|
||||
|
||||
Reference in New Issue
Block a user