diff --git a/native/redux/persist-constants.js b/native/redux/persist-constants.js --- a/native/redux/persist-constants.js +++ b/native/redux/persist-constants.js @@ -5,6 +5,6 @@ // NOTE: renaming this constant requires updating // `native/native_rust_library/build.rs` to correctly // scrap Redux state version from this file. -const storeVersion = 93; +const storeVersion = 94; export { rootKey, storeVersion }; diff --git a/native/redux/persist.js b/native/redux/persist.js --- a/native/redux/persist.js +++ b/native/redux/persist.js @@ -22,6 +22,10 @@ ReplaceEntryOperation, } from 'lib/ops/entries-store-ops'; import { entryStoreOpsHandlers } from 'lib/ops/entries-store-ops.js'; +import { + type HolderStoreOperation, + createReplaceHoldersOperation, +} from 'lib/ops/holder-store-ops.js'; import { type ClientDBIntegrityStoreOperation, integrityStoreOpsHandlers, @@ -1666,6 +1670,26 @@ }, }; }: MigrationFunction), + [94]: (async (state: AppState) => { + const storedHolders = state.holderStore.storedHolders; + + const holderItems = entries(storedHolders).map(([hash, holderInfo]) => ({ + hash, + holder: holderInfo.holder, + status: holderInfo.status, + })); + + const operations: $ReadOnlyArray = [ + createReplaceHoldersOperation(holderItems), + ]; + + return { + state, + ops: { + holderStoreOperations: operations, + }, + }; + }: MigrationFunction), }); const persistConfig = { 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,6 +3,6 @@ const rootKey = 'root'; const rootKeyPrefix = 'persist:'; const completeRootKey = `${rootKeyPrefix}${rootKey}`; -const storeVersion = 93; +const storeVersion = 94; 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 @@ -7,6 +7,10 @@ import type { PersistConfig } from 'redux-persist/src/types.js'; import { createReplaceThreadOperation } from 'lib/ops/create-replace-thread-operation.js'; +import { + type HolderStoreOperation, + createReplaceHoldersOperation, +} from 'lib/ops/holder-store-ops.js'; import { type ClientDBKeyserverStoreOperation, keyserverStoreOpsHandlers, @@ -880,6 +884,26 @@ }, }; }: MigrationFunction), + [94]: (async (state: AppState) => { + const storedHolders = state.holderStore.storedHolders; + + const holderItems = entries(storedHolders).map(([hash, holderInfo]) => ({ + hash, + holder: holderInfo.holder, + status: holderInfo.status, + })); + + const operations: $ReadOnlyArray = [ + createReplaceHoldersOperation(holderItems), + ]; + + return { + state, + ops: { + holderStoreOperations: operations, + }, + }; + }: MigrationFunction), }; const persistConfig: PersistConfig = {