mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-27 17:48:17 -05:00
Compare commits
3 Commits
react-quer
...
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;
|
const tables = event.tables;
|
||||||
|
|
||||||
if (tables.includes('prefs')) {
|
if (tables.includes('prefs')) {
|
||||||
|
|||||||
@@ -638,10 +638,18 @@ export const fullSync = once(async function (): Promise<
|
|||||||
|
|
||||||
const tables = getTablesFromMessages(messages);
|
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', {
|
app.events.emit('sync', {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
tables,
|
tables,
|
||||||
syncDisabled: checkSyncingMode('disabled'),
|
syncDisabled: checkSyncingMode('disabled'),
|
||||||
|
messageCount,
|
||||||
});
|
});
|
||||||
return { messages };
|
return { messages };
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ export type LocalPrefs = Partial<{
|
|||||||
'budget.showHiddenCategories': boolean;
|
'budget.showHiddenCategories': boolean;
|
||||||
'budget.startMonth': string;
|
'budget.startMonth': string;
|
||||||
'flags.updateNotificationShownForVersion': string;
|
'flags.updateNotificationShownForVersion': string;
|
||||||
|
'flags.syncPerformanceNotificationDismissed': boolean;
|
||||||
'schedules.showCompleted': boolean;
|
'schedules.showCompleted': boolean;
|
||||||
reportsViewLegend: boolean;
|
reportsViewLegend: boolean;
|
||||||
reportsViewSummary: boolean;
|
reportsViewSummary: boolean;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ type SyncEvent = {
|
|||||||
type: 'success';
|
type: 'success';
|
||||||
tables: string[];
|
tables: string[];
|
||||||
syncDisabled?: boolean;
|
syncDisabled?: boolean;
|
||||||
|
messageCount?: number;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: 'error';
|
type: 'error';
|
||||||
|
|||||||
Reference in New Issue
Block a user