-
Notifications
You must be signed in to change notification settings - Fork 4k
Add 'Don't show this again' checkbox for empty reports dialog #75442
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9c564aa
Add 'Don't show this again' checkbox for empty reports dialog
ShridharGoel 31aeae9
Lint fixes
ShridharGoel 73f8b4f
Copy updates
ShridharGoel e43d59a
Lint fix
ShridharGoel d03711d
Merge main
ShridharGoel 064ec7b
Lint fix
ShridharGoel 5d386bf
Merge main
ShridharGoel 1a833b7
Prettier fix
ShridharGoel 044b451
Merge main
ShridharGoel 933fe46
Lint fixes
ShridharGoel 715beca
Add translations
ShridharGoel a8adea1
Merge main
ShridharGoel abaa121
Merge branch 'main' into emptyReportsCheckBox
ShridharGoel 70ee8f1
Merge branch 'main' of https://github.com/Expensify/App into emptyRep…
ShridharGoel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -276,7 +276,7 @@ | |
| let currentUserAccountID = -1; | ||
| let currentUserEmail: string | undefined; | ||
|
|
||
| Onyx.connect({ | ||
| key: ONYXKEYS.SESSION, | ||
| callback: (value) => { | ||
| // When signed out, val is undefined | ||
|
|
@@ -289,7 +289,7 @@ | |
| }, | ||
| }); | ||
|
|
||
| Onyx.connect({ | ||
| key: ONYXKEYS.CONCIERGE_REPORT_ID, | ||
| callback: (value) => (conciergeReportID = value), | ||
| }); | ||
|
|
@@ -297,7 +297,7 @@ | |
| // map of reportID to all reportActions for that report | ||
| const allReportActions: OnyxCollection<ReportActions> = {}; | ||
|
|
||
| Onyx.connect({ | ||
| key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, | ||
| callback: (actions, key) => { | ||
| if (!key || !actions) { | ||
|
|
@@ -309,14 +309,14 @@ | |
| }); | ||
|
|
||
| let allTransactionViolations: OnyxCollection<TransactionViolations> = {}; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, | ||
| waitForCollectionCallback: true, | ||
| callback: (value) => (allTransactionViolations = value), | ||
| }); | ||
|
|
||
| let allReports: OnyxCollection<Report>; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.COLLECTION.REPORT, | ||
| waitForCollectionCallback: true, | ||
| callback: (value) => { | ||
|
|
@@ -325,7 +325,7 @@ | |
| }); | ||
|
|
||
| let isNetworkOffline = false; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.NETWORK, | ||
| callback: (value) => { | ||
| isNetworkOffline = value?.isOffline ?? false; | ||
|
|
@@ -333,7 +333,7 @@ | |
| }); | ||
|
|
||
| let allPersonalDetails: OnyxEntry<PersonalDetailsList> = {}; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.PERSONAL_DETAILS_LIST, | ||
| callback: (value) => { | ||
| allPersonalDetails = value ?? {}; | ||
|
|
@@ -348,7 +348,7 @@ | |
| }); | ||
|
|
||
| let onboarding: OnyxEntry<Onboarding>; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.NVP_ONBOARDING, | ||
| callback: (val) => { | ||
| if (Array.isArray(val)) { | ||
|
|
@@ -359,13 +359,13 @@ | |
| }); | ||
|
|
||
| let introSelected: OnyxEntry<IntroSelected> = {}; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.NVP_INTRO_SELECTED, | ||
| callback: (val) => (introSelected = val), | ||
| }); | ||
|
|
||
| let allReportDraftComments: Record<string, string | undefined> = {}; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT, | ||
| waitForCollectionCallback: true, | ||
| callback: (value) => (allReportDraftComments = value), | ||
|
|
@@ -3046,6 +3046,7 @@ | |
| isASAPSubmitBetaEnabled: boolean, | ||
| policyID?: string, | ||
| shouldNotifyNewAction = false, | ||
| shouldDismissEmptyReportsConfirmation?: boolean, | ||
| ) { | ||
| // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 | ||
| // eslint-disable-next-line @typescript-eslint/no-deprecated | ||
|
|
@@ -3064,9 +3065,21 @@ | |
| isASAPSubmitBetaEnabled, | ||
| ); | ||
|
|
||
| if (shouldDismissEmptyReportsConfirmation) { | ||
| Onyx.merge(ONYXKEYS.NVP_EMPTY_REPORTS_CONFIRMATION_DISMISSED, true); | ||
| } | ||
|
|
||
| API.write( | ||
| WRITE_COMMANDS.CREATE_APP_REPORT, | ||
| {reportName: optimisticReportName, type: CONST.REPORT.TYPE.EXPENSE, policyID, reportID: optimisticReportID, reportActionID, reportPreviewReportActionID}, | ||
| { | ||
| reportName: optimisticReportName, | ||
| type: CONST.REPORT.TYPE.EXPENSE, | ||
| policyID, | ||
| reportID: optimisticReportID, | ||
| reportActionID, | ||
| reportPreviewReportActionID, | ||
| ...(shouldDismissEmptyReportsConfirmation ? {shouldDismissEmptyReportsConfirmation} : {}), | ||
|
Member
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. why are we spreading this?
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. Because this param is optional. We'll not be sending it during a normal report creation. |
||
| }, | ||
| {optimisticData, successData, failureData}, | ||
| ); | ||
| if (shouldNotifyNewAction) { | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
❌ PERF-4 (docs)
The inline arrow function
(value) => setShouldDismissEmptyReportsConfirmation(!!value)creates a new function reference on every render, causing unnecessary re-renders of theCheckboxWithLabelcomponent.Suggested fix: Extract this into a memoized callback: