fix: stale settings used when syncing books (#273)

* fix: add passive: true to touchstart event listener when pulling to refresh

* fix: stale settings used when syncing books and move auto upload from import menu to settings menu
This commit is contained in:
Huang Xin
2025-01-30 23:50:06 +01:00
committed by GitHub
parent 90e46860a5
commit b6c8bfb52b
4 changed files with 27 additions and 32 deletions
+4
View File
@@ -94,6 +94,10 @@ export function useSync(bookKey?: string) {
if (!records?.length) return;
const maxTime = computeMaxTimestamp(records);
setLastSyncedAt(maxTime);
// due to closures in React hooks the settings might be stale
// we need to fetch the latest settings from store
const settings = useSettingsStore.getState().settings;
switch (type) {
case 'books':
settings.lastSyncedAtBooks = maxTime;