Update compareLocalSave(): ignore sync conflict if only locale present

Problem: there's always a Google Drive sync conflict modal opening when connecting because the user's locale is saved from the start

Solution implemented: if the local save only consists of the user's locale, ignores the sync conflict
This commit is contained in:
François 2024-02-19 14:03:10 +01:00 committed by GitHub
parent 2c10c11dee
commit a47cc7b480
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -201,8 +201,12 @@
const localSave = await getLocalSaveJson();
const localSize = new Blob([localSave]).size / 1000;
const negligibleKeys = ['converted', 'locale'];
const localSaveKeys = Object.keys(JSON.parse(localSave));
const isLocalSaveNegligible = localSaveKeys.every(key => negligibleKeys.includes(key));
const remoteTime = dayjs(data[UPDATE_TIME_KEY]);
if ($updateTime !== null && remoteTime.diff($updateTime) !== 0) {
if ($updateTime !== null && !isLocalSaveNegligible && remoteTime.diff($updateTime) !== 0) {
console.log('DRIVE SYNC CONFLICT!');
openModal(
SyncConflictModal,