Skip to content

Commit

Permalink
move SELECTED_TAB to collections
Browse files Browse the repository at this point in the history
  • Loading branch information
kosmydel committed Sep 7, 2023
1 parent bfdf844 commit 0aa14f2
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ const ONYXKEYS = {
// The last update ID that was applied to the client
ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT: 'OnyxUpdatesLastUpdateIDAppliedToClient',

// Manual request tab selector
SELECTED_TAB: 'selectedTab',

// Receipt upload modal
RECEIPT_MODAL: 'receiptModal',

Expand Down Expand Up @@ -254,6 +251,9 @@ const ONYXKEYS = {
SECURITY_GROUP: 'securityGroup_',
TRANSACTION: 'transactions_',

// Manual request tab selector
SELECTED_TAB: 'selectedTab_',

/** This is deprecated, but needed for a migration, so we still need to include it here so that it will be initialized in Onyx.init */
DEPRECATED_POLICY_MEMBER_LIST: 'policyMemberList_',
},
Expand Down Expand Up @@ -363,7 +363,6 @@ type OnyxValues = {
[ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID]: string;
[ONYXKEYS.PREFERRED_THEME]: ValueOf<typeof CONST.THEME>;
[ONYXKEYS.IS_USING_MEMORY_ONLY_KEYS]: boolean;
[ONYXKEYS.SELECTED_TAB]: string;
[ONYXKEYS.RECEIPT_MODAL]: OnyxTypes.ReceiptModal;
[ONYXKEYS.MAPBOX_ACCESS_TOKEN]: OnyxTypes.MapboxAccessToken;
[ONYXKEYS.ONYX_UPDATES_FROM_SERVER]: number;
Expand All @@ -389,6 +388,7 @@ type OnyxValues = {
[ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING]: boolean;
[ONYXKEYS.COLLECTION.SECURITY_GROUP]: OnyxTypes.SecurityGroup;
[ONYXKEYS.COLLECTION.TRANSACTION]: OnyxTypes.Transaction;
[ONYXKEYS.COLLECTION.SELECTED_TAB]: string;

// Forms
[ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM]: OnyxTypes.AddDebitCardForm;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/OnyxTabNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ OnyxTabNavigator.displayName = 'OnyxTabNavigator';

export default withOnyx({
selectedTab: {
key: ({id}) => `${ONYXKEYS.SELECTED_TAB}_${id}`,
key: ({id}) => `${ONYXKEYS.COLLECTION.SELECTED_TAB}${id}`,
},
})(OnyxTabNavigator);
2 changes: 1 addition & 1 deletion src/libs/actions/Tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ONYXKEYS from '../../ONYXKEYS';
* Sets the selected tab for a given tab ID
*/
function setSelectedTab(id: string, index: string) {
Onyx.merge(`${ONYXKEYS.SELECTED_TAB}_${id}`, index);
Onyx.merge(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${id}`, index);
}

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/MoneyRequestDatePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ export default withOnyx({
key: ONYXKEYS.IOU,
},
selectedTab: {
key: `${ONYXKEYS.SELECTED_TAB}_${CONST.TAB.RECEIPT_TAB_ID}`,
key: `${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.RECEIPT_TAB_ID}`,
},
})(MoneyRequestDatePage);
2 changes: 1 addition & 1 deletion src/pages/iou/MoneyRequestDescriptionPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,6 @@ export default withOnyx({
key: ONYXKEYS.IOU,
},
selectedTab: {
key: `${ONYXKEYS.SELECTED_TAB}_${CONST.TAB.RECEIPT_TAB_ID}`,
key: `${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.RECEIPT_TAB_ID}`,
},
})(MoneyRequestDescriptionPage);
2 changes: 1 addition & 1 deletion src/pages/iou/MoneyRequestSelectorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,6 @@ export default withOnyx({
key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${route.params.reportID}`,
},
selectedTab: {
key: `${ONYXKEYS.SELECTED_TAB}_${CONST.TAB.RECEIPT_TAB_ID}`,
key: `${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.RECEIPT_TAB_ID}`,
},
})(MoneyRequestSelectorPage);
2 changes: 1 addition & 1 deletion src/pages/iou/steps/MoneyRequestConfirmPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export default compose(
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
},
selectedTab: {
key: `${ONYXKEYS.SELECTED_TAB}_${CONST.TAB.RECEIPT_TAB_ID}`,
key: `${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.RECEIPT_TAB_ID}`,
},
}),
)(MoneyRequestConfirmPage);
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default compose(
withOnyx({
iou: {key: ONYXKEYS.IOU},
selectedTab: {
key: `${ONYXKEYS.SELECTED_TAB}_${CONST.TAB.RECEIPT_TAB_ID}`,
key: `${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.RECEIPT_TAB_ID}`,
},
}),
)(MoneyRequestParticipantsPage);
2 changes: 1 addition & 1 deletion src/pages/iou/steps/NewRequestAmountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,6 @@ export default withOnyx({
key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${lodashGet(route, 'params.reportID', '')}`,
},
selectedTab: {
key: `${ONYXKEYS.SELECTED_TAB}_${CONST.TAB.RECEIPT_TAB_ID}`,
key: `${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.RECEIPT_TAB_ID}`,
},
})(NewRequestAmountPage);

0 comments on commit 0aa14f2

Please sign in to comment.