diff --git a/web/redux/persist-constants.js b/web/redux/persist-constants.js --- a/web/redux/persist-constants.js +++ b/web/redux/persist-constants.js @@ -3,5 +3,6 @@ const rootKey = 'root'; const rootKeyPrefix = 'persist:'; const completeRootKey = `${rootKeyPrefix}${rootKey}`; +const storeVersion = 75; -export { rootKey, rootKeyPrefix, completeRootKey }; +export { rootKey, rootKeyPrefix, completeRootKey, storeVersion }; diff --git a/web/redux/persist.js b/web/redux/persist.js --- a/web/redux/persist.js +++ b/web/redux/persist.js @@ -47,7 +47,7 @@ handleReduxMigrationFailure, persistWhitelist, } from './handle-redux-migration-failure.js'; -import { rootKey, rootKeyPrefix } from './persist-constants.js'; +import { rootKey, rootKeyPrefix, storeVersion } from './persist-constants.js'; import type { AppState } from './redux-setup.js'; import { unshimClientDB } from './unshim-utils.js'; import { authoritativeKeyserverID } from '../authoritative-keyserver.js'; @@ -530,7 +530,7 @@ (error: Error, state: AppState) => handleReduxMigrationFailure(state), migrateStorageToSQLite, ): any), - version: 75, + version: storeVersion, transforms: [messageStoreMessagesBlocklistTransform, keyserverStoreTransform], }; diff --git a/web/shared-worker/types/sqlite-query-executor.js b/web/shared-worker/types/sqlite-query-executor.js --- a/web/shared-worker/types/sqlite-query-executor.js +++ b/web/shared-worker/types/sqlite-query-executor.js @@ -159,6 +159,7 @@ restoreFromMainCompaction( mainCompactionPath: string, mainCompactionEncryptionKey: string, + maxVersion: string, ): void; restoreFromBackupLog(backupLog: Uint8Array): void; diff --git a/web/shared-worker/worker/backup.js b/web/shared-worker/worker/backup.js --- a/web/shared-worker/worker/backup.js +++ b/web/shared-worker/worker/backup.js @@ -9,7 +9,10 @@ BackupClient, RequestedData, } from '../../backup-client-wasm/wasm/backup-client-wasm.js'; -import { completeRootKey } from '../../redux/persist-constants.js'; +import { + completeRootKey, + storeVersion, +} from '../../redux/persist-constants.js'; import type { EmscriptenModule } from '../types/module.js'; import type { SQLiteQueryExecutor } from '../types/sqlite-query-executor.js'; import { COMM_SQLITE_BACKUP_RESTORE_DATABASE_PATH } from '../utils/constants.js'; @@ -53,6 +56,7 @@ sqliteQueryExecutor.restoreFromMainCompaction( COMM_SQLITE_BACKUP_RESTORE_DATABASE_PATH, backupDataKey, + `${storeVersion ?? -1}`, ); sqliteQueryExecutor.setPersistStorageItem(