Skip to content

Commit 4343ec1

Browse files
authored
Merge pull request #85980 from callstack-internal/JKobrynski/feat/80091-part1-fix
[Onyx audit] Migrate keys to RAM-only - part 1/2 (including bugfix)
2 parents 2aa69b1 + cabc43c commit 4343ec1

37 files changed

Lines changed: 81 additions & 78 deletions

src/Expensify.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Expensify() {
5959
const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: accountIDSelector});
6060
const [lastRoute] = useOnyx(ONYXKEYS.LAST_ROUTE);
6161
const [isCheckingPublicRoom = true] = useOnyx(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, {initWithStoredValues: false});
62-
const [updateRequired] = useOnyx(ONYXKEYS.UPDATE_REQUIRED, {initWithStoredValues: false});
62+
const [updateRequired] = useOnyx(ONYXKEYS.RAM_ONLY_UPDATE_REQUIRED);
6363
const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH);
6464

6565
useDebugShortcut();

src/ONYXKEYS.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const ONYXKEYS = {
3434
IS_SIDEBAR_LOADED: 'isSidebarLoaded',
3535

3636
/** Boolean flag set whenever we are searching for reports in the server */
37-
IS_SEARCHING_FOR_REPORTS: 'isSearchingForReports',
37+
RAM_ONLY_IS_SEARCHING_FOR_REPORTS: 'isSearchingForReports',
3838

3939
/** Note: These are Persisted Requests - not all requests in the main queue as the key name might lead one to believe */
4040
PERSISTED_REQUESTS: 'networkRequestQueue',
@@ -95,7 +95,7 @@ const ONYXKEYS = {
9595
CURRENCY_LIST: 'currencyList',
9696

9797
/** Indicates whether an update is available and ready to be installed. */
98-
UPDATE_AVAILABLE: 'updateAvailable',
98+
RAM_ONLY_UPDATE_AVAILABLE: 'updateAvailable',
9999

100100
/** Indicates that a request to join a screen share with a GuidesPlus agent was received */
101101
SCREEN_SHARE_REQUEST: 'screenShareRequest',
@@ -328,7 +328,7 @@ const ONYXKEYS = {
328328
USER_METADATA: 'userMetadata',
329329

330330
/** Object containing Onfido SDK Token + applicantID */
331-
WALLET_ONFIDO: 'walletOnfido',
331+
RAM_ONLY_WALLET_ONFIDO: 'walletOnfido',
332332

333333
/** Stores information about additional details form entry */
334334
WALLET_ADDITIONAL_DETAILS: 'walletAdditionalDetails',
@@ -473,7 +473,7 @@ const ONYXKEYS = {
473473
RECENTLY_USED_REPORT_FIELDS: 'recentlyUsedReportFields',
474474

475475
/** Indicates whether an forced upgrade is required */
476-
UPDATE_REQUIRED: 'updateRequired',
476+
RAM_ONLY_UPDATE_REQUIRED: 'updateRequired',
477477

478478
/** Indicates a global supportal permission denial that should surface a modal */
479479
SUPPORTAL_PERMISSION_DENIED: 'supportalPermissionDenied',
@@ -1075,7 +1075,7 @@ const ONYXKEYS = {
10751075
PERSONAL_AND_WORKSPACE_CARD_LIST: 'personalAndWorkspaceCardList',
10761076
CARD_FEED_ERRORS: 'cardFeedErrors',
10771077
TODOS: 'todos',
1078-
SORTED_REPORT_ACTIONS: 'sortedReportActions',
1078+
RAM_ONLY_SORTED_REPORT_ACTIONS: 'sortedReportActions',
10791079
},
10801080

10811081
/** Stores HybridApp specific state required to interoperate with OldDot */
@@ -1314,7 +1314,7 @@ type OnyxValuesMapping = {
13141314
[ONYXKEYS.PERSONAL_DETAILS_METADATA]: Record<string, OnyxTypes.PersonalDetailsMetadata>;
13151315
[ONYXKEYS.TASK]: OnyxTypes.Task;
13161316
[ONYXKEYS.CURRENCY_LIST]: OnyxTypes.CurrencyList;
1317-
[ONYXKEYS.UPDATE_AVAILABLE]: boolean;
1317+
[ONYXKEYS.RAM_ONLY_UPDATE_AVAILABLE]: boolean;
13181318
[ONYXKEYS.SCREEN_SHARE_REQUEST]: OnyxTypes.ScreenShareRequest;
13191319
[ONYXKEYS.COUNTRY_CODE]: number;
13201320
[ONYXKEYS.COUNTRY]: string;
@@ -1372,7 +1372,7 @@ type OnyxValuesMapping = {
13721372
[ONYXKEYS.NVP_PRIVATE_BILLING_DISPUTE_PENDING]: number;
13731373
[ONYXKEYS.NVP_PRIVATE_BILLING_STATUS]: OnyxTypes.BillingStatus;
13741374
[ONYXKEYS.USER_WALLET]: OnyxTypes.UserWallet;
1375-
[ONYXKEYS.WALLET_ONFIDO]: OnyxTypes.WalletOnfido;
1375+
[ONYXKEYS.RAM_ONLY_WALLET_ONFIDO]: OnyxTypes.WalletOnfido;
13761376
[ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes.WalletAdditionalDetails;
13771377
[ONYXKEYS.WALLET_TERMS]: OnyxTypes.WalletTerms;
13781378
[ONYXKEYS.BANK_ACCOUNT_LIST]: OnyxTypes.BankAccountList;
@@ -1420,10 +1420,10 @@ type OnyxValuesMapping = {
14201420
[ONYXKEYS.ONBOARDING_POLICY_ID]: string;
14211421
[ONYXKEYS.ONBOARDING_ADMINS_CHAT_REPORT_ID]: string;
14221422
[ONYXKEYS.ONBOARDING_LAST_VISITED_PATH]: string;
1423-
[ONYXKEYS.IS_SEARCHING_FOR_REPORTS]: boolean;
1423+
[ONYXKEYS.RAM_ONLY_IS_SEARCHING_FOR_REPORTS]: boolean;
14241424
[ONYXKEYS.LAST_VISITED_PATH]: string | undefined;
14251425
[ONYXKEYS.RECENTLY_USED_REPORT_FIELDS]: OnyxTypes.RecentlyUsedReportFields;
1426-
[ONYXKEYS.UPDATE_REQUIRED]: boolean;
1426+
[ONYXKEYS.RAM_ONLY_UPDATE_REQUIRED]: boolean;
14271427
[ONYXKEYS.SUPPORTAL_PERMISSION_DENIED]: OnyxTypes.SupportalPermissionDenied | null;
14281428
[ONYXKEYS.RESET_REQUIRED]: boolean;
14291429
[ONYXKEYS.PLAID_CURRENT_EVENT]: string;
@@ -1520,7 +1520,7 @@ type OnyxDerivedValuesMapping = {
15201520
[ONYXKEYS.DERIVED.PERSONAL_AND_WORKSPACE_CARD_LIST]: OnyxTypes.PersonalAndWorkspaceCardListDerivedValue;
15211521
[ONYXKEYS.DERIVED.CARD_FEED_ERRORS]: OnyxTypes.CardFeedErrorsDerivedValue;
15221522
[ONYXKEYS.DERIVED.TODOS]: OnyxTypes.TodosDerivedValue;
1523-
[ONYXKEYS.DERIVED.SORTED_REPORT_ACTIONS]: OnyxTypes.SortedReportActionsDerivedValue;
1523+
[ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS]: OnyxTypes.SortedReportActionsDerivedValue;
15241524
};
15251525

15261526
type OnyxValues = OnyxValuesMapping & OnyxCollectionValuesMapping & OnyxFormValuesMapping & OnyxFormDraftValuesMapping & OnyxDerivedValuesMapping;

src/components/BaseVacationDelegateSelectionComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function BaseVacationDelegateSelectionComponent({
5454
const styles = useThemeStyles();
5555
const icons = useMemoizedLazyExpensifyIcons(['FallbackAvatar']);
5656
const [countryCode = CONST.DEFAULT_COUNTRY_CODE] = useOnyx(ONYXKEYS.COUNTRY_CODE);
57-
const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false});
57+
const [isSearchingForReports] = useOnyx(ONYXKEYS.RAM_ONLY_IS_SEARCHING_FOR_REPORTS);
5858

5959
const currentVacationDelegate = vacationDelegate?.delegate ?? '';
6060
const delegatePersonalDetails = getPersonalDetailByEmail(currentVacationDelegate);

src/components/Search/FilterDropdowns/UserSelectPopup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function UserSelectPopup({value, closeOverlay, onChange, isSearchable}: UserSele
4747
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
4848
const currentUserAccountID = currentUserPersonalDetails.accountID;
4949
const shouldFocusInputOnScreenFocus = canFocusInputOnScreenFocus();
50-
const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false});
50+
const [isSearchingForReports] = useOnyx(ONYXKEYS.RAM_ONLY_IS_SEARCHING_FOR_REPORTS);
5151
const initialSelectedOptions = useMemo(() => {
5252
return value.reduce<OptionData[]>((options, id) => {
5353
const participant = personalDetails?.[id];

src/components/Search/SearchFiltersChatsSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function SearchFiltersChatsSelector({initialReportIDs, onFiltersUpdate, isScreen
5858
const currentUserAccountID = currentUserPersonalDetails.accountID;
5959
const currentUserEmail = currentUserPersonalDetails.email ?? '';
6060

61-
const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false});
61+
const [isSearchingForReports] = useOnyx(ONYXKEYS.RAM_ONLY_IS_SEARCHING_FOR_REPORTS);
6262
const reportAttributesDerived = useReportAttributes();
6363
const [selectedReportIDs, setSelectedReportIDs] = useState<string[]>(initialReportIDs);
6464
const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState('');

src/components/Search/SearchFiltersParticipantsSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function SearchFiltersParticipantsSelector({initialAccountIDs, onFiltersUpdate,
6161
const {translate, formatPhoneNumber} = useLocalize();
6262
const personalDetails = usePersonalDetails();
6363
const {didScreenTransitionEnd} = useScreenWrapperTransitionStatus();
64-
const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false});
64+
const [isSearchingForReports] = useOnyx(ONYXKEYS.RAM_ONLY_IS_SEARCHING_FOR_REPORTS);
6565
const reportAttributesDerived = useReportAttributes();
6666
const privateIsArchivedMap = usePrivateIsArchivedMap();
6767
const currentUserPersonalDetails = useCurrentUserPersonalDetails();

src/components/Search/SearchRouter/SearchRouter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
6262
const {setShouldResetSearchQuery} = useSearchActionsContext();
6363
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
6464
const currentUserAccountID = currentUserPersonalDetails.accountID;
65-
const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false});
65+
const [isSearchingForReports] = useOnyx(ONYXKEYS.RAM_ONLY_IS_SEARCHING_FOR_REPORTS);
6666
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
6767
const [betas] = useOnyx(ONYXKEYS.BETAS);
6868
const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector});

src/components/UpdateAppModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import ConfirmModal from './ConfirmModal';
77
function UpdateAppModal() {
88
const [isModalOpen, setIsModalOpen] = useState(true);
99
const {translate} = useLocalize();
10-
const [updateAvailable] = useOnyx(ONYXKEYS.UPDATE_AVAILABLE, {initWithStoredValues: false});
10+
const [updateAvailable] = useOnyx(ONYXKEYS.RAM_ONLY_UPDATE_AVAILABLE);
1111

1212
if (!updateAvailable) {
1313
return null;

src/hooks/useSearchSelector.base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function useSearchSelectorBase({
195195
const [draftComments] = useOnyx(ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT);
196196
const [nvpDismissedProductTraining] = useOnyx(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING);
197197
const [visibleReportActionsData] = useOnyx(ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS);
198-
const [sortedActions] = useOnyx(ONYXKEYS.DERIVED.SORTED_REPORT_ACTIONS, {selector: sortedActionsSelector});
198+
const [sortedActions] = useOnyx(ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS, {selector: sortedActionsSelector});
199199
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
200200
const currentUserAccountID = currentUserPersonalDetails.accountID;
201201
const currentUserEmail = currentUserPersonalDetails.email ?? '';

src/libs/OptionsListUtils/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ Onyx.connect({
215215
},
216216
});
217217

218-
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
218+
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
219219
const deprecatedLastReportActions: ReportActions = {};
220-
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
220+
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
221221
const deprecatedAllSortedReportActions: Record<string, ReportAction[]> = {};
222-
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
222+
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
223223
const deprecatedCachedOneTransactionThreadReportIDs: Record<string, string | undefined> = {};
224-
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
224+
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
225225
let deprecatedAllReportActions: OnyxCollection<ReportActions>;
226226
Onyx.connect({
227227
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,

0 commit comments

Comments
 (0)