Skip to content

Commit

Permalink
fix: RemoveEMptyActionDrafts
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispader committed Jun 5, 2024
1 parent e6bcbe6 commit 57ae961
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libs/migrations/RemoveEmptyReportActionsDrafts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import type {OnyxEntry} from 'react-native-onyx';
import type {OnyxEntry, OnyxInputValue} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import Log from '@libs/Log';
import ONYXKEYS from '@src/ONYXKEYS';
Expand All @@ -24,7 +24,7 @@ export default function (): Promise<void> {
return resolve();
}

const newReportActionsDrafts: Record<ReportActionsDraftsKey, OnyxEntry<ReportActionsDrafts>> = {};
const newReportActionsDrafts: Record<ReportActionsDraftsKey, OnyxInputValue<ReportActionsDrafts>> = {};
Object.entries(allReportActionsDrafts).forEach(([onyxKey, reportActionDrafts]) => {
const newReportActionsDraftsForReport: Record<string, ReportActionsDraft> = {};

Expand Down Expand Up @@ -54,7 +54,7 @@ export default function (): Promise<void> {
if (isEmptyObject(newReportActionsDraftsForReport)) {
Log.info('[Migrate Onyx] NO REMAINING');
// Clear if there are no drafts remaining
newReportActionsDrafts[onyxKey as ReportActionsDraftsKey] = undefined;
newReportActionsDrafts[onyxKey as ReportActionsDraftsKey] = null;
} else if (hasUnmigratedDraft) {
// Only migrate if there are unmigrated drafts, there's no need to overwrite this onyx key with the same data
newReportActionsDrafts[onyxKey as ReportActionsDraftsKey] = newReportActionsDraftsForReport;
Expand Down

0 comments on commit 57ae961

Please sign in to comment.