-
Notifications
You must be signed in to change notification settings - Fork 4k
Remove Onyx.connect() for the key: ONYXKEYS.COLLECTION.REPORT in src/libs/ReportUtils.ts (part 5) #93267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Onyx.connect() for the key: ONYXKEYS.COLLECTION.REPORT in src/libs/ReportUtils.ts (part 5) #93267
Changes from all commits
8f8c69c
3c92305
6830d02
5816f8d
5e05fbe
bf66b16
69dd980
3f60cdc
051acea
882f648
51a9f8e
e555959
8b0f233
f5bf27d
d416b10
018c0c6
f1825ac
ddf10b3
e427691
f5ca257
0bcceec
80fb674
c7ffa68
12921ee
2343286
f4e82f9
de2754e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11554,6 +11554,12 @@ type PrepareOnboardingOnyxDataParams = { | |
| onboardingPurposeSelected?: OnboardingPurpose; | ||
| // TODO: isSelfTourViewed will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424 | ||
| isSelfTourViewed?: boolean; | ||
| /** The concierge chat report, looked up by conciergeReportID. Falls back to getChatByParticipants using the deprecated module-level Onyx data while the refactor is in progress. */ | ||
| conciergeChat?: OnyxEntry<Report>; | ||
| /** The admins chat report, looked up by adminsChatReportID. Falls back to the deprecated module-level Onyx data while the refactor is in progress. */ | ||
| adminsChatReport?: OnyxEntry<Report>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A boolean flag should be enough. I’d prefer to avoid passing a large object unnecessarily.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we can use a selector here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@DylanDylann What do you mean by using "boolean flag" here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, let's ignore this |
||
| /** The self-DM report, looked up by ONYXKEYS.SELF_DM_REPORT_ID. Falls back to the deprecated module-level Onyx data while the refactor is in progress. */ | ||
| selfDMReport?: OnyxEntry<Report>; | ||
| }; | ||
|
|
||
| function prepareOnboardingOnyxData({ | ||
|
|
@@ -11568,6 +11574,9 @@ function prepareOnboardingOnyxData({ | |
| isInvitedAccountant, | ||
| onboardingPurposeSelected, | ||
| isSelfTourViewed, | ||
| conciergeChat: conciergeChatParam, | ||
| adminsChatReport: adminsChatReportParam, | ||
| selfDMReport: selfDMReportParam, | ||
| }: PrepareOnboardingOnyxDataParams) { | ||
| if (engagementChoice === CONST.ONBOARDING_CHOICES.PERSONAL_SPEND) { | ||
| // eslint-disable-next-line no-param-reassign | ||
|
|
@@ -11582,8 +11591,9 @@ function prepareOnboardingOnyxData({ | |
| const shouldPostTasksInAdminsRoom = isPostingTasksInAdminsRoom(engagementChoice); | ||
| // Server picks the inboxAdminsBespoke variant at response time, so optimistic writes here would be stale. | ||
| const shouldDeferOptimisticTasks = engagementChoice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM; | ||
| const adminsChatReport = deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${adminsChatReportID}`]; | ||
| const adminsChatReport = adminsChatReportParam ?? deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${adminsChatReportID}`]; | ||
| const conciergeChat = | ||
| conciergeChatParam ?? | ||
| getChatByParticipants([CONST.ACCOUNT_ID.CONCIERGE, deprecatedCurrentUserAccountID ?? CONST.DEFAULT_NUMBER_ID], deprecatedAllReports, false) ?? | ||
| (conciergeReportIDOnyxConnect ? {reportID: conciergeReportIDOnyxConnect} : undefined); | ||
| const targetChatReport = shouldPostTasksInAdminsRoom | ||
|
|
@@ -11977,7 +11987,8 @@ function prepareOnboardingOnyxData({ | |
| lastVisibleActionCreated: '', | ||
| hasOutstandingChildTask: false, | ||
| }; | ||
| const report = deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${targetChatReportID}`]; | ||
| // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- targetChatReport may be a stub with only reportID/policyID/chatType; the consumers below handle missing fields gracefully. | ||
| const report = targetChatReport as OnyxEntry<Report>; | ||
| const canUserPerformWriteActionVariable = canUserPerformWriteAction(report, false); | ||
| const {lastMessageText = ''} = getLastVisibleMessageActionUtils(targetChatReportID, canUserPerformWriteActionVariable); | ||
| if (lastMessageText) { | ||
|
|
@@ -12088,7 +12099,7 @@ function prepareOnboardingOnyxData({ | |
| (!onboardingPurposeSelected || onboardingPurposeSelected === CONST.ONBOARDING_CHOICES.PERSONAL_SPEND || onboardingPurposeSelected === CONST.ONBOARDING_CHOICES.TRACK_PERSONAL)) | ||
| ) { | ||
| const selfDMReportID = findSelfDMReportID(); | ||
| let selfDMReport = deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${selfDMReportID}`]; | ||
| let selfDMReport = selfDMReportParam ?? deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${selfDMReportID}`]; | ||
| let createdAction: ReportAction; | ||
| if (!selfDMReport) { | ||
| const currentTime = DateUtils.getDBTime(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this place, I notice
const engagementChoice: "newDotTrackWorkspace" | "newDotTrackPersonalWorkspace"Could we eliminate any parameter? Please go through all the places to ensure there are no redundant params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DylanDylann I resolved your comment