Apply cached TTS location before remote progress

This commit is contained in:
Richard R 2026-05-31 13:23:52 -06:00
parent eebb54b018
commit 2a2ba35454

View file

@ -3228,19 +3228,6 @@ export function TTSProvider({ children }: { children: ReactNode }): ReactElement
};
const load = async () => {
try {
const remote = await getDocumentProgress(docId);
if (!cancelled && remote?.location) {
await setLastDocumentLocation(docId, remote.location).catch((error) => {
console.warn('Error caching remote location locally:', error);
});
applyLocation(remote.location);
return;
}
} catch (error) {
console.warn('Error loading remote progress:', error);
}
try {
const local = await getLastDocumentLocation(docId);
if (!cancelled && local) {
@ -3249,6 +3236,18 @@ export function TTSProvider({ children }: { children: ReactNode }): ReactElement
} catch (error) {
console.warn('Error loading local last location:', error);
}
try {
const remote = await getDocumentProgress(docId);
if (!cancelled && remote?.location) {
await setLastDocumentLocation(docId, remote.location).catch((error) => {
console.warn('Error caching remote location locally:', error);
});
applyLocation(remote.location);
}
} catch (error) {
console.warn('Error loading remote progress:', error);
}
};
load();