diff --git a/lib/utils/report-utils.js b/lib/utils/report-utils.js --- a/lib/utils/report-utils.js +++ b/lib/utils/report-utils.js @@ -1,6 +1,7 @@ // @flow import { useSelector } from './redux-utils.js'; +import { getUUID } from './uuid.js'; import { type SupportedReports, type EnabledReports, @@ -26,4 +27,13 @@ ); } -export { useIsReportEnabled, isReportEnabled }; +function assignReportsID( + reports: $ReadOnlyArray, +): $ReadOnlyArray { + return reports.map((report: ClientReportCreationRequest) => ({ + ...report, + id: getUUID(), + })); +} + +export { useIsReportEnabled, isReportEnabled, assignReportsID }; diff --git a/native/redux/persist.js b/native/redux/persist.js --- a/native/redux/persist.js +++ b/native/redux/persist.js @@ -36,6 +36,7 @@ translateRawMessageInfoToClientDBMessageInfo, } from 'lib/utils/message-ops-utils.js'; import { defaultNotifPermissionAlertInfo } from 'lib/utils/push-alerts.js'; +import { assignReportsID } from 'lib/utils/report-utils.js'; import { convertClientDBThreadInfoToRawThreadInfo, convertRawThreadInfoToClientDBThreadInfo, @@ -533,6 +534,13 @@ [38]: state => updateClientDBThreadStoreThreadInfos(state, updateRolesAndPermissions), [39]: (state: AppState) => unshimClientDB(state, [messageTypes.EDIT_MESSAGE]), + [40]: (state: AppState) => { + const queuedReports = assignReportsID(state.reportStore.queuedReports); + return { + ...state, + reportStore: { ...state.reportStore, queuedReports }, + }; + }, }; // After migration 31, we'll no longer want to persist `messageStore.messages` @@ -613,7 +621,7 @@ 'storeLoaded', ], debug: __DEV__, - version: 39, + version: 40, transforms: [messageStoreMessagesBlocklistTransform], migrate: (createMigrate(migrations, { debug: __DEV__ }): any), timeout: ((__DEV__ ? 0 : undefined): number | void),