-
Notifications
You must be signed in to change notification settings - Fork 4k
Remove Onyx.connect() for the key: ONYXKEYS.NVP_RECENT_WAYPOINTS from trackExpense function #80237
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
Changes from all commits
d0cb56d
06c3771
18264a0
ca21b86
900c32e
ee2930f
d3f2d46
b61409f
ddca299
cef1492
e6e6274
f6cb410
0547f89
88072b9
cbcbf68
beb2421
45d5dae
537dfe1
d5e6f57
ca80271
3d6f2e0
9dcf54f
a2d5900
14210a7
2dd7718
b623161
32e4901
5e1feae
bed3e48
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 |
|---|---|---|
|
|
@@ -714,6 +714,7 @@ | |
| introSelected: OnyxEntry<OnyxTypes.IntroSelected>; | ||
| activePolicyID: string | undefined; | ||
| quickAction: OnyxEntry<OnyxTypes.QuickAction>; | ||
| recentWaypoints: OnyxEntry<OnyxTypes.RecentWaypoint[]>; | ||
| }; | ||
|
|
||
| type GetTrackExpenseInformationTransactionParams = { | ||
|
|
@@ -761,7 +762,7 @@ | |
|
|
||
| let allPersonalDetails: OnyxTypes.PersonalDetailsList = {}; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.PERSONAL_DETAILS_LIST, | ||
| callback: (value) => { | ||
| allPersonalDetails = value ?? {}; | ||
| }, | ||
|
|
@@ -854,7 +855,7 @@ | |
| let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {}; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, | ||
| waitForCollectionCallback: true, | ||
| callback: (value) => { | ||
| allTransactionDrafts = value ?? {}; | ||
| }, | ||
|
|
@@ -868,7 +869,7 @@ | |
| if (!value) { | ||
| allTransactionViolations = {}; | ||
| return; | ||
| } | ||
|
|
||
| allTransactionViolations = value; | ||
| }, | ||
|
|
@@ -877,7 +878,7 @@ | |
| let allPolicyTags: OnyxCollection<OnyxTypes.PolicyTagLists> = {}; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.COLLECTION.POLICY_TAGS, | ||
| waitForCollectionCallback: true, | ||
| callback: (value) => { | ||
| if (!value) { | ||
| allPolicyTags = {}; | ||
|
|
@@ -891,7 +892,7 @@ | |
| Onyx.connect({ | ||
| key: ONYXKEYS.COLLECTION.REPORT, | ||
| waitForCollectionCallback: true, | ||
| callback: (value) => { | ||
| allReports = value; | ||
| }, | ||
| }); | ||
|
|
@@ -904,7 +905,7 @@ | |
| allReportNameValuePairs = value; | ||
| }, | ||
| }); | ||
|
|
||
| let userAccountID = -1; | ||
| let currentUserEmail = ''; | ||
| Onyx.connect({ | ||
|
|
@@ -913,7 +914,7 @@ | |
| currentUserEmail = value?.email ?? ''; | ||
| userAccountID = value?.accountID ?? CONST.DEFAULT_NUMBER_ID; | ||
| }, | ||
| }); | ||
|
|
||
| let deprecatedCurrentUserPersonalDetails: OnyxEntry<OnyxTypes.PersonalDetails>; | ||
| Onyx.connect({ | ||
|
|
@@ -923,7 +924,7 @@ | |
| }, | ||
| }); | ||
|
|
||
| let allReportActions: OnyxCollection<OnyxTypes.ReportActions>; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, | ||
| waitForCollectionCallback: true, | ||
|
|
@@ -932,7 +933,7 @@ | |
| return; | ||
| } | ||
| allReportActions = actions; | ||
| }, | ||
| }); | ||
|
|
||
| let personalDetailsList: OnyxEntry<OnyxTypes.PersonalDetailsList>; | ||
|
|
@@ -940,7 +941,7 @@ | |
| key: ONYXKEYS.PERSONAL_DETAILS_LIST, | ||
| callback: (value) => (personalDetailsList = value), | ||
| }); | ||
|
|
||
| // Use connectWithoutView because this is created for non-UI task only | ||
| let recentAttendees: OnyxEntry<Attendee[]>; | ||
| Onyx.connectWithoutView({ | ||
|
|
@@ -948,13 +949,10 @@ | |
| callback: (value) => (recentAttendees = value), | ||
| }); | ||
|
|
||
| // TODO: remove `recentWaypoints` from this file (https://github.com/Expensify/App/issues/73024) | ||
| // `recentWaypoints` was moved here temporarily from `src/libs/actions/Policy/Tag.ts` during the `Deprecate Onyx.connect` refactor. | ||
| // All uses of this variable should be replaced with `useOnyx`. | ||
| let recentWaypoints: OnyxTypes.RecentWaypoint[] = []; | ||
| let deprecatedRecentWaypoints: OnyxTypes.RecentWaypoint[] = []; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.NVP_RECENT_WAYPOINTS, | ||
| callback: (val) => (recentWaypoints = val ?? []), | ||
| callback: (val) => (deprecatedRecentWaypoints = val ?? []), | ||
| }); | ||
|
|
||
| function getAllPersonalDetails(): OnyxTypes.PersonalDetailsList { | ||
|
|
@@ -985,6 +983,15 @@ | |
| return userAccountID; | ||
| } | ||
|
|
||
| function getRecentWaypoints(): OnyxTypes.RecentWaypoint[] { | ||
|
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. NAB: Should we update the name of this function so no one adds new calls being unaware that this is already deprecated? We can do that in a follow up if it makes sense.
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. I think that we could, but as well as other getter functions in this file, ultimately we'll get rid if it - I think that it can take a while to remove it from here, so we can leave it as it is. The worst case scenario is someone will need it with their migration, so will use it too. If you strongly feel like we should label it with @deprecated, then I can add it, otherwise I would leave it without extra comments just like getter functions above 👍 |
||
| return deprecatedRecentWaypoints; | ||
| } | ||
|
|
||
| /** | ||
| * This function uses Onyx.connect and should be replaced with useOnyx for reactive data access. | ||
| * TODO: remove `getPolicyTagsData` from this file (https://github.com/Expensify/App/issues/72721) | ||
| * All usages of this function should be replaced with params passed to the functions or useOnyx hook in React components. | ||
| */ | ||
| function getPolicyTags(): OnyxCollection<OnyxTypes.PolicyTagLists> { | ||
| return allPolicyTags; | ||
| } | ||
|
|
@@ -5340,7 +5347,7 @@ | |
| } | ||
|
|
||
| if (!distance) { | ||
| const recentServerValidatedWaypoints = recentWaypoints.filter((item) => !item.pendingAction); | ||
| const recentServerValidatedWaypoints = deprecatedRecentWaypoints.filter((item) => !item.pendingAction); | ||
| onyxData?.failureData?.push({ | ||
| onyxMethod: Onyx.METHOD.SET, | ||
| key: `${ONYXKEYS.NVP_RECENT_WAYPOINTS}`, | ||
|
|
@@ -6543,6 +6550,7 @@ | |
| introSelected, | ||
| activePolicyID, | ||
| quickAction, | ||
| recentWaypoints = [], | ||
| } = params; | ||
| const {participant, payeeAccountID, payeeEmail} = participantParams; | ||
| const {policy, policyCategories, policyTagList} = policyData; | ||
|
|
@@ -7683,7 +7691,7 @@ | |
| }; | ||
| } | ||
|
|
||
| const recentServerValidatedWaypoints = recentWaypoints.filter((item) => !item.pendingAction); | ||
| const recentServerValidatedWaypoints = deprecatedRecentWaypoints.filter((item) => !item.pendingAction); | ||
| onyxData?.failureData?.push({ | ||
| onyxMethod: Onyx.METHOD.SET, | ||
| key: `${ONYXKEYS.NVP_RECENT_WAYPOINTS}`, | ||
|
|
@@ -13178,6 +13186,7 @@ | |
| getAllReportActionsFromIOU, | ||
| getCurrentUserEmail, | ||
| getUserAccountID, | ||
| getRecentWaypoints, | ||
|
Guccio163 marked this conversation as resolved.
|
||
| getReceiptError, | ||
| getSearchOnyxUpdate, | ||
| getPolicyTags, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.