forked from akai/readest
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user