@@ -245,7 +245,12 @@ function getPolicyParamsForOpenOrReconnect(): Promise<PolicyParamsForOpenOrRecon
245245/**
246246 * Returns the Onyx data that is used for both the OpenApp and ReconnectApp API commands.
247247 */
248- function getOnyxDataForOpenOrReconnect ( isOpenApp = false , isFullReconnect = false , shouldKeepPublicRooms = false , allReportsDraftComment ?: Record < string , string | undefined > ) : OnyxData {
248+ function getOnyxDataForOpenOrReconnect (
249+ isOpenApp = false ,
250+ isFullReconnect = false ,
251+ shouldKeepPublicRooms = false ,
252+ allReportsWithDraftComments ?: Record < string , string | undefined > ,
253+ ) : OnyxData {
249254 const result : OnyxData = {
250255 optimisticData : [
251256 {
@@ -308,12 +313,12 @@ function getOnyxDataForOpenOrReconnect(isOpenApp = false, isFullReconnect = fals
308313
309314 // Find all reports that have a non-null draft comment and map them to their corresponding report objects from allReports
310315 // This ensures that any report with a draft comment is preserved in Onyx even if it doesn’t contain chat history
311- const reportsHaveDraftComments = Object . entries ( allReportsDraftComment ?? { } )
316+ const reportsWithDraftComments = Object . entries ( allReportsWithDraftComments ?? { } )
312317 . filter ( ( [ , value ] ) => value !== null )
313318 . map ( ( [ key ] ) => key . replace ( ONYXKEYS . COLLECTION . REPORT_DRAFT_COMMENT , '' ) )
314319 . map ( ( reportID ) => allReports ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ reportID } ` ] ) ;
315320
316- reportsHaveDraftComments ?. forEach ( ( report ) => {
321+ reportsWithDraftComments ?. forEach ( ( report ) => {
317322 result . successData ?. push ( {
318323 onyxMethod : Onyx . METHOD . MERGE ,
319324 key : `${ ONYXKEYS . COLLECTION . REPORT } ${ report ?. reportID } ` ,
@@ -329,10 +334,10 @@ function getOnyxDataForOpenOrReconnect(isOpenApp = false, isFullReconnect = fals
329334/**
330335 * Fetches data needed for app initialization
331336 */
332- function openApp ( shouldKeepPublicRooms = false , allReportsDraftComment ?: Record < string , string | undefined > ) {
337+ function openApp ( shouldKeepPublicRooms = false , allReportsWithDraftComments ?: Record < string , string | undefined > ) {
333338 return getPolicyParamsForOpenOrReconnect ( ) . then ( ( policyParams : PolicyParamsForOpenOrReconnect ) => {
334339 const params : OpenAppParams = { enablePriorityModeFilter : true , ...policyParams } ;
335- return API . writeWithNoDuplicatesConflictAction ( WRITE_COMMANDS . OPEN_APP , params , getOnyxDataForOpenOrReconnect ( true , undefined , shouldKeepPublicRooms , allReportsDraftComment ) ) ;
340+ return API . writeWithNoDuplicatesConflictAction ( WRITE_COMMANDS . OPEN_APP , params , getOnyxDataForOpenOrReconnect ( true , undefined , shouldKeepPublicRooms , allReportsWithDraftComments ) ) ;
336341 } ) ;
337342}
338343
0 commit comments