diff --git a/native/redux/persist.js b/native/redux/persist.js --- a/native/redux/persist.js +++ b/native/redux/persist.js @@ -25,6 +25,10 @@ type MessageStore, type ClientDBMessageStoreOperation, } from 'lib/types/message-types.js'; +import type { + ReportStore, + ClientReportCreationRequest, +} from 'lib/types/report-types.js'; import { defaultConnectionInfo } from 'lib/types/socket-types.js'; import type { ClientDBThreadStoreOperation, @@ -606,6 +610,20 @@ { whitelist: ['messageStore'] }, ); +type PersistedReportStore = $Diff< + ReportStore, + { +queuedReports: $ReadOnlyArray }, +>; +const reportStoreTransform: Transform = createTransform( + (state: ReportStore): PersistedReportStore => { + return { enabledReports: state.enabledReports }; + }, + (state: PersistedReportStore): ReportStore => { + return { ...state, queuedReports: [] }; + }, + { whitelist: ['reportStore'] }, +); + const persistConfig = { key: 'root', storage: AsyncStorage, @@ -622,7 +640,7 @@ ], debug: __DEV__, version: 40, - transforms: [messageStoreMessagesBlocklistTransform], + transforms: [messageStoreMessagesBlocklistTransform, reportStoreTransform], migrate: (createMigrate(migrations, { debug: __DEV__ }): any), timeout: ((__DEV__ ? 0 : undefined): number | void), };