Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DelegateAccessHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function DelegateAccessHandler() {
const [stashedCredentials = CONST.EMPTY_OBJECT] = useOnyx(ONYXKEYS.STASHED_CREDENTIALS);
const [stashedSession] = useOnyx(ONYXKEYS.STASHED_SESSION);
const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP);
const [isLoadingApp] = useOnyx(ONYXKEYS.RAM_ONLY_IS_LOADING_APP);
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);
const [sessionAccountID] = useOnyx(ONYXKEYS.SESSION, {selector: accountIDSelector});
const [sessionEmail] = useOnyx(ONYXKEYS.SESSION, {selector: emailSelector});
const {isOffline} = useNetwork();
Expand Down
24 changes: 12 additions & 12 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const ONYXKEYS = {
DEVICE_ID: 'deviceID',

/** Boolean flag set whenever the sidebar has loaded */
RAM_ONLY_IS_SIDEBAR_LOADED: 'isSidebarLoaded',
IS_SIDEBAR_LOADED: 'isSidebarLoaded',

/** Boolean flag set whenever we are searching for reports in the server */
RAM_ONLY_IS_SEARCHING_FOR_REPORTS: 'isSearchingForReports',
Expand Down Expand Up @@ -210,7 +210,7 @@ const ONYXKEYS = {
NVP_PREFERRED_LOCALE: 'nvp_preferredLocale',

/** Whether the app is currently loading a translation */
RAM_ONLY_ARE_TRANSLATIONS_LOADING: 'areTranslationsLoading',
ARE_TRANSLATIONS_LOADING: 'areTranslationsLoading',

/** Whether the user has tried focus mode yet */
NVP_TRY_FOCUS_MODE: 'nvp_tryFocusMode',
Expand Down Expand Up @@ -373,7 +373,7 @@ const ONYXKEYS = {
SHARE_BANK_ACCOUNT: 'shareBankAccount',

/** Is report data loading? */
RAM_ONLY_IS_LOADING_REPORT_DATA: 'isLoadingReportData',
IS_LOADING_REPORT_DATA: 'isLoadingReportData',

/** Set when we are loading bank accounts for share page */
IS_LOADING_SHARE_BANK_ACCOUNTS: 'isLoadingShareBankAccounts',
Expand All @@ -382,7 +382,7 @@ const ONYXKEYS = {
IS_LOADING_BULK_CHANGE_APPROVER_PAGE: 'isLoadingBulkChangeApproverPage',

/** Is report data loading? */
RAM_ONLY_IS_LOADING_APP: 'isLoadingApp',
IS_LOADING_APP: 'isLoadingApp',

/** Is loading policy rules preview? */
IS_LOADING_POLICY_CODING_RULES_PREVIEW: 'isLoadingPolicyCodingRulesPreview',
Expand Down Expand Up @@ -541,7 +541,7 @@ const ONYXKEYS = {
ASSIGN_CARD: 'assignCard',

/** Stores the information if mobile selection mode is active */
RAM_ONLY_MOBILE_SELECTION_MODE: 'mobileSelectionMode',
MOBILE_SELECTION_MODE: 'mobileSelectionMode',

NVP_PRIVATE_CANCELLATION_DETAILS: 'nvp_private_cancellationDetails',

Expand Down Expand Up @@ -796,7 +796,7 @@ const ONYXKEYS = {
NVP_EXPENSIFY_REPORT_PDF_FILENAME: 'nvp_expensify_report_PDFFilename_',

/** Stores the information about the state of issuing a new card */
RAM_ONLY_ISSUE_NEW_EXPENSIFY_CARD: 'issueNewExpensifyCard_',
ISSUE_NEW_EXPENSIFY_CARD: 'issueNewExpensifyCard_',

/** Used for identifying user as admin of a domain */
SHARED_NVP_PRIVATE_ADMIN_ACCESS: 'sharedNVP_private_admin_access_',
Expand Down Expand Up @@ -1275,7 +1275,7 @@ type OnyxCollectionValuesMapping = {
[ONYXKEYS.COLLECTION.LAST_SELECTED_FEED]: OnyxTypes.CompanyCardFeedWithDomainID;
[ONYXKEYS.COLLECTION.LAST_SELECTED_EXPENSIFY_CARD_FEED]: OnyxTypes.FundID;
[ONYXKEYS.COLLECTION.NVP_EXPENSIFY_ON_CARD_WAITLIST]: OnyxTypes.CardOnWaitlist;
[ONYXKEYS.COLLECTION.RAM_ONLY_ISSUE_NEW_EXPENSIFY_CARD]: OnyxTypes.IssueNewCard;
[ONYXKEYS.COLLECTION.ISSUE_NEW_EXPENSIFY_CARD]: OnyxTypes.IssueNewCard;
[ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS]: boolean;
[ONYXKEYS.COLLECTION.SAML_METADATA]: OnyxTypes.SamlMetadata;
[ONYXKEYS.COLLECTION.DOMAIN_PENDING_ACTIONS]: OnyxTypes.DomainPendingActions;
Expand All @@ -1299,7 +1299,7 @@ type OnyxValuesMapping = {
[ONYXKEYS.RECENTLY_USED_CURRENCIES]: string[];
[ONYXKEYS.ACTIVE_CLIENTS]: string[];
[ONYXKEYS.DEVICE_ID]: string;
[ONYXKEYS.RAM_ONLY_IS_SIDEBAR_LOADED]: boolean;
[ONYXKEYS.IS_SIDEBAR_LOADED]: boolean;
[ONYXKEYS.PERSISTED_REQUESTS]: OnyxTypes.AnyRequest[];
[ONYXKEYS.PERSISTED_ONGOING_REQUESTS]: OnyxTypes.AnyRequest;
[ONYXKEYS.CURRENT_DATE]: string;
Expand Down Expand Up @@ -1366,7 +1366,7 @@ type OnyxValuesMapping = {
[ONYXKEYS.ONFIDO_TOKEN]: string;
[ONYXKEYS.ONFIDO_APPLICANT_ID]: string;
[ONYXKEYS.NVP_PREFERRED_LOCALE]: OnyxTypes.Locale;
[ONYXKEYS.RAM_ONLY_ARE_TRANSLATIONS_LOADING]: boolean;
[ONYXKEYS.ARE_TRANSLATIONS_LOADING]: boolean;
[ONYXKEYS.NVP_ACTIVE_POLICY_ID]: string;
[ONYXKEYS.NVP_DISMISSED_REFERRAL_BANNERS]: OnyxTypes.DismissedReferralBanners;
[ONYXKEYS.NVP_HAS_SEEN_TRACK_TRAINING]: boolean;
Expand Down Expand Up @@ -1399,12 +1399,12 @@ type OnyxValuesMapping = {
[ONYXKEYS.IS_LOADING_SHARE_BANK_ACCOUNTS]: boolean;
[ONYXKEYS.IS_LOADING_BULK_CHANGE_APPROVER_PAGE]: boolean;
[ONYXKEYS.IS_LOADING_POLICY_CODING_RULES_PREVIEW]: boolean;
[ONYXKEYS.RAM_ONLY_IS_LOADING_REPORT_DATA]: boolean;
[ONYXKEYS.IS_SEARCH_FILTERS_CARD_DATA_LOADED]: boolean;
[ONYXKEYS.IS_LOADING_SUBSCRIPTION_DATA]: boolean;
[ONYXKEYS.IS_SEARCH_PAGE_DATA_LOADED]: boolean;
[ONYXKEYS.IS_LOADING_REPORT_DATA]: boolean;
[ONYXKEYS.IS_TEST_TOOLS_MODAL_OPEN]: boolean;
[ONYXKEYS.RAM_ONLY_IS_LOADING_APP]: boolean;
[ONYXKEYS.IS_LOADING_APP]: boolean;
[ONYXKEYS.HAS_LOADED_APP]: boolean;
[ONYXKEYS.WALLET_TRANSFER]: OnyxTypes.WalletTransfer;
[ONYXKEYS.LAST_ACCESSED_WORKSPACE_POLICY_ID]: string;
Expand Down Expand Up @@ -1452,7 +1452,7 @@ type OnyxValuesMapping = {
[ONYXKEYS.ADD_NEW_COMPANY_CARD]: OnyxTypes.AddNewCompanyCardFeed;
[ONYXKEYS.ADD_NEW_PERSONAL_CARD]: OnyxTypes.AddNewPersonalCard;
[ONYXKEYS.ASSIGN_CARD]: OnyxTypes.AssignCard;
[ONYXKEYS.RAM_ONLY_MOBILE_SELECTION_MODE]: boolean;
[ONYXKEYS.MOBILE_SELECTION_MODE]: boolean;
[ONYXKEYS.DUPLICATE_WORKSPACE]: OnyxTypes.DuplicateWorkspace;
[ONYXKEYS.NVP_FIRST_DAY_FREE_TRIAL]: string;
[ONYXKEYS.NVP_LAST_DAY_FREE_TRIAL]: string;
Expand Down
13 changes: 5 additions & 8 deletions src/components/AddPlaidBankAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,18 @@ function AddPlaidBankAccount({
const subscribedKeyboardShortcuts = useRef<Array<() => void>>([]);
const previousNetworkState = useRef<boolean | undefined>(undefined);
const [selectedPlaidAccountMask, setSelectedPlaidAccountMask] = useState(defaultSelectedPlaidAccountMask);
const [plaidLinkToken] = useOnyx(ONYXKEYS.PLAID_LINK_TOKEN);
const [isPlaidTokenReady, setIsPlaidTokenReady] = useState(false);
const [plaidLinkToken] = useOnyx(ONYXKEYS.PLAID_LINK_TOKEN, {initWithStoredValues: false});
const [isPlaidDisabled] = useOnyx(ONYXKEYS.IS_PLAID_DISABLED);
const {translate} = useLocalize();
const {isOffline} = useNetwork();

const getPlaidLinkToken = (): string | undefined => {
if (receivedRedirectURI && plaidLinkOAuthToken) {
return plaidLinkOAuthToken;
if (plaidLinkToken) {
return plaidLinkToken;
}

if (isPlaidTokenReady && plaidLinkToken) {
return plaidLinkToken;
if (receivedRedirectURI && plaidLinkOAuthToken) {
return plaidLinkOAuthToken;
}
};

Expand Down Expand Up @@ -141,11 +140,9 @@ function AddPlaidBankAccount({

// If we're coming from Plaid OAuth flow then we need to reuse the existing plaidLinkToken
if (isAuthenticatedWithPlaid()) {
setIsPlaidTokenReady(true);
return unsubscribeToNavigationShortcuts;
}
openPlaidBankLogin(allowDebit, bankAccountID);
setIsPlaidTokenReady(true);
return unsubscribeToNavigationShortcuts;

// disabling this rule, as we want this to run only on the first render
Expand Down
2 changes: 1 addition & 1 deletion src/components/LocaleContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const COLLATOR_OPTIONS: Intl.CollatorOptions = {usage: 'sort', sensitivity: 'var

function LocaleContextProvider({children}: LocaleContextProviderProps) {
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const [areTranslationsLoading = true] = useOnyx(ONYXKEYS.RAM_ONLY_ARE_TRANSLATIONS_LOADING);
const [areTranslationsLoading = true] = useOnyx(ONYXKEYS.ARE_TRANSLATIONS_LOADING, {initWithStoredValues: false});
const [countryCodeByIP = 1] = useOnyx(ONYXKEYS.COUNTRY_CODE);
const [nvpPreferredLocale, nvpPreferredLocaleMetadata] = useOnyx(ONYXKEYS.NVP_PREFERRED_LOCALE);
const [currentLocale, setCurrentLocale] = useState<Locale | undefined>(() => IntlStore.getCurrentLocale());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function MoneyRequestReportView({report, policy, reportMetadata, shouldDisplayRe
const {isSmallScreenWidth} = useResponsiveLayout();

const reportID = report?.reportID;
const [isLoadingApp] = useOnyx(ONYXKEYS.RAM_ONLY_IS_LOADING_APP);
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);
const {reportPendingAction, reportErrors} = getReportOfflinePendingActionAndErrors(report);
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(report?.chatReportID)}`);

Expand Down
2 changes: 1 addition & 1 deletion src/components/PriorityModeController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const isInFocusModeSelector = (priorityMode: OnyxEntry<ValueOf<typeof CONST.PRIO
export default function PriorityModeController() {
const {orderedReportIDs} = useSidebarOrderedReportsState();
const lhnReportCount = orderedReportIDs.length;
const [isLoadingReportData] = useOnyx(ONYXKEYS.RAM_ONLY_IS_LOADING_REPORT_DATA);
const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA);
const [isInFocusMode, isInFocusModeMetadata] = useOnyx(ONYXKEYS.NVP_PRIORITY_MODE, {selector: isInFocusModeSelector});
const [hasTriedFocusMode, hasTriedFocusModeMetadata] = useOnyx(ONYXKEYS.NVP_TRY_FOCUS_MODE);
const currentRouteName = useCurrentRouteName();
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProductTrainingContext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const ProductTrainingContext = createContext<ProductTrainingContextType>({
});

function ProductTrainingContextProvider({children}: ChildrenProps) {
const [isLoadingApp = true] = useOnyx(ONYXKEYS.RAM_ONLY_IS_LOADING_APP);
const [isLoadingApp = true] = useOnyx(ONYXKEYS.IS_LOADING_APP);
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT);
const hasBeenAddedToNudgeMigration = !!tryNewDot?.nudgeMigration?.timestamp;
const [isOnboardingCompleted = true, isOnboardingCompletedMetadata] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function TransactionGroupListExpanded<TItem extends ListItem>({
const {windowWidth} = useWindowDimensions();
const currentUserDetails = useCurrentUserPersonalDetails();
const {translate} = useLocalize();
const [isMobileSelectionModeEnabled] = useOnyx(ONYXKEYS.RAM_ONLY_MOBILE_SELECTION_MODE);
const [isMobileSelectionModeEnabled] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [betas] = useOnyx(ONYXKEYS.BETAS);
const [visibleColumns] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {selector: columnsSelector});
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useMobileSelectionMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useOnyx from './useOnyx';
import usePrevious from './usePrevious';

export default function useMobileSelectionMode(onTurnOffSelectionMode = () => {}) {
const [isSelectionModeEnabled = false] = useOnyx(ONYXKEYS.RAM_ONLY_MOBILE_SELECTION_MODE);
const [isSelectionModeEnabled = false] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE, {initWithStoredValues: false});
const initialSelectionModeValueRef = useRef(isSelectionModeEnabled);
const prevIsSelectionModeEnabled = usePrevious(isSelectionModeEnabled);

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useOnboardingFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import useOnyx from './useOnyx';
*/
function useOnboardingFlowRouter() {
const currentUrl = getCurrentUrl();
const [isLoadingApp = true] = useOnyx(ONYXKEYS.RAM_ONLY_IS_LOADING_APP);
const [isLoadingApp = true] = useOnyx(ONYXKEYS.IS_LOADING_APP);
const [onboardingValues, isOnboardingCompletedMetadata] = useOnyx(ONYXKEYS.NVP_ONBOARDING);
const [sessionEmail] = useOnyx(ONYXKEYS.SESSION, {selector: emailSelector});
const isLoggingInAsNewSessionUser = isLoggingInAsNewUser(currentUrl, sessionEmail);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useSearchBackPress/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ONYXKEYS from '@src/ONYXKEYS';
import type UseSearchBackPress from './types';

const useSearchBackPress: UseSearchBackPress = ({onClearSelection, onNavigationCallBack}) => {
const [selectionMode] = useOnyx(ONYXKEYS.RAM_ONLY_MOBILE_SELECTION_MODE);
const [selectionMode] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE);
useFocusEffect(
useCallback(() => {
const onBackPress = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/languages/IntlStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type zhHans from './zh-hans';
// This function was added here to avoid circular dependencies
function setAreTranslationsLoading(areTranslationsLoading: boolean) {
// eslint-disable-next-line rulesdir/prefer-actions-set-data
Onyx.set(ONYXKEYS.RAM_ONLY_ARE_TRANSLATIONS_LOADING, areTranslationsLoading);
Onyx.set(ONYXKEYS.ARE_TRANSLATIONS_LOADING, areTranslationsLoading);
}

class IntlStore {
Expand Down
4 changes: 2 additions & 2 deletions src/libs/Navigation/AppNavigator/AuthScreensInitHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function initializePusher(currentUserAccountID?: number, getReportAttributes?: (
* Extracted from AuthScreens to isolate useOnyx subscriptions:
* - SESSION, NVP_INTRO_SELECTED, NVP_ACTIVE_POLICY_ID,
* NVP_ONBOARDING (tour selector), ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT (x2),
* RAM_ONLY_IS_LOADING_APP
* IS_LOADING_APP
*/
function AuthScreensInitHandler() {
const currentUrl = getCurrentUrl();
Expand All @@ -59,7 +59,7 @@ function AuthScreensInitHandler() {
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector});
const [lastUpdateIDAppliedToClient] = useOnyx(ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT);
const [isLoadingApp] = useOnyx(ONYXKEYS.RAM_ONLY_IS_LOADING_APP);
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);
const lastUpdateIDAppliedToClientRef = useRef(lastUpdateIDAppliedToClient);
const isLoadingAppRef = useRef(isLoadingApp);

Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/guards/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Onyx.connectWithoutView({
});

Onyx.connectWithoutView({
key: ONYXKEYS.RAM_ONLY_IS_LOADING_APP,
key: ONYXKEYS.IS_LOADING_APP,
callback: (value) => {
isLoadingApp = value ?? true;
},
Expand Down
2 changes: 1 addition & 1 deletion src/libs/PersonalDetailsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
let personalDetails: Array<PersonalDetails | null> = [];
let allPersonalDetails: OnyxEntry<PersonalDetailsList> = {};
let emailToPersonalDetailsCache: Record<string, PersonalDetails> = {};
Onyx.connect({

Check warning on line 26 in src/libs/PersonalDetailsUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (val) => {
personalDetails = Object.values(val ?? {});
Expand All @@ -40,8 +40,8 @@
let hiddenTranslation = '';
let youTranslation = '';

Onyx.connect({

Check warning on line 43 in src/libs/PersonalDetailsUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.RAM_ONLY_ARE_TRANSLATIONS_LOADING,
key: ONYXKEYS.ARE_TRANSLATIONS_LOADING,
callback: (value) => {
if (value ?? true) {
return;
Expand Down
3 changes: 2 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@
};

let conciergeReportIDOnyxConnect: OnyxEntry<string>;
Onyx.connect({

Check warning on line 1048 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportIDOnyxConnect = value;
Expand All @@ -1053,7 +1053,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 1056 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -1071,7 +1071,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 1074 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (deprecatedCurrentUserAccountID) {
Expand All @@ -1083,7 +1083,7 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 1086 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
Expand All @@ -1091,7 +1091,7 @@

let allPolicies: OnyxCollection<Policy>;
let policiesArray: Policy[] = [];
Onyx.connect({

Check warning on line 1094 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1101,7 +1101,7 @@
});

let allPolicyDrafts: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 1104 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_DRAFTS,
waitForCollectionCallback: true,
callback: (value) => (allPolicyDrafts = value),
Expand All @@ -1109,7 +1109,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 1112 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -1145,7 +1145,7 @@
});

let betaConfiguration: OnyxEntry<BetaConfiguration> = {};
Onyx.connect({

Check warning on line 1148 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETA_CONFIGURATION,
callback: (value) => (betaConfiguration = value ?? {}),
});
Expand Down Expand Up @@ -1255,7 +1255,8 @@
let unavailableTranslation = '';

Onyx.connect({
key: ONYXKEYS.RAM_ONLY_ARE_TRANSLATIONS_LOADING,
key: ONYXKEYS.ARE_TRANSLATIONS_LOADING,
initWithStoredValues: false,
callback: (value) => {
if (value ?? true) {
return;
Expand Down
29 changes: 15 additions & 14 deletions src/libs/actions/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ Onyx.connectWithoutView({
// `useOnyx` would trigger extra rerenders without affecting the View, so `Onyx.connectWithoutView` is used instead
let isSidebarLoaded: boolean | undefined;
Onyx.connectWithoutView({
key: ONYXKEYS.RAM_ONLY_IS_SIDEBAR_LOADED,
key: ONYXKEYS.IS_SIDEBAR_LOADED,
callback: (val) => (isSidebarLoaded = val),
initWithStoredValues: false,
});

// `isUsingImportedState` is used in `openApp`, `reconnectApp`, and `clearOnyxAndResetApp` to prevent API calls when using imported state.
Expand Down Expand Up @@ -120,9 +121,9 @@ Onyx.connectWithoutView({

const KEYS_TO_PRESERVE: OnyxKey[] = [
ONYXKEYS.ACCOUNT,
ONYXKEYS.RAM_ONLY_IS_LOADING_APP,
ONYXKEYS.RAM_ONLY_IS_SIDEBAR_LOADED,
ONYXKEYS.IS_CHECKING_PUBLIC_ROOM,
ONYXKEYS.IS_LOADING_APP,
ONYXKEYS.IS_SIDEBAR_LOADED,
ONYXKEYS.MODAL,
ONYXKEYS.NETWORK,
ONYXKEYS.SESSION,
Expand Down Expand Up @@ -219,11 +220,11 @@ function setSidebarLoaded() {
return;
}

Onyx.set(ONYXKEYS.RAM_ONLY_IS_SIDEBAR_LOADED, true);
Onyx.set(ONYXKEYS.IS_SIDEBAR_LOADED, true);
}

function setAppLoading(isLoading: boolean) {
Onyx.set(ONYXKEYS.RAM_ONLY_IS_LOADING_APP, isLoading);
Onyx.set(ONYXKEYS.IS_LOADING_APP, isLoading);
}

/**
Expand Down Expand Up @@ -297,9 +298,9 @@ function getPolicyParamsForOpenOrReconnect(): Promise<PolicyParamsForOpenOrRecon

type OnyxDataForOpenOrReconnectKeys =
| typeof ONYXKEYS.COLLECTION.REPORT
| typeof ONYXKEYS.RAM_ONLY_IS_LOADING_REPORT_DATA
| typeof ONYXKEYS.IS_LOADING_REPORT_DATA
| typeof ONYXKEYS.HAS_LOADED_APP
| typeof ONYXKEYS.RAM_ONLY_IS_LOADING_APP
| typeof ONYXKEYS.IS_LOADING_APP
| typeof ONYXKEYS.LAST_FULL_RECONNECT_TIME;

/**
Expand All @@ -322,24 +323,24 @@ function getOnyxDataForOpenOrReconnect(
Log.info(`[App] isLoadingReportData set to true`, false, {command: commandName});

const result: OnyxData<
| typeof ONYXKEYS.RAM_ONLY_IS_LOADING_REPORT_DATA
| typeof ONYXKEYS.IS_LOADING_REPORT_DATA
| typeof ONYXKEYS.HAS_LOADED_APP
| typeof ONYXKEYS.RAM_ONLY_IS_LOADING_APP
| typeof ONYXKEYS.IS_LOADING_APP
| typeof ONYXKEYS.COLLECTION.REPORT
| typeof ONYXKEYS.LAST_FULL_RECONNECT_TIME
> = {
optimisticData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.RAM_ONLY_IS_LOADING_REPORT_DATA,
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
value: true,
},
],
successData: [],
finallyData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.RAM_ONLY_IS_LOADING_REPORT_DATA,
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
value: false,
},
],
Expand All @@ -355,13 +356,13 @@ function getOnyxDataForOpenOrReconnect(
if (isOpenApp) {
result.optimisticData?.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.RAM_ONLY_IS_LOADING_APP,
key: ONYXKEYS.IS_LOADING_APP,
value: true,
});

result.finallyData?.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.RAM_ONLY_IS_LOADING_APP,
key: ONYXKEYS.IS_LOADING_APP,
value: false,
});
}
Expand Down Expand Up @@ -423,7 +424,7 @@ function openApp(shouldKeepPublicRooms = false, allReportsWithDraftComments?: Re
// Exception: When forceRun is true (exiting imported state), always make the API call
if (isUsingImportedState && !forceRun) {
Onyx.multiSet({
[ONYXKEYS.RAM_ONLY_IS_LOADING_APP]: false,
[ONYXKEYS.IS_LOADING_APP]: false,
[ONYXKEYS.HAS_LOADED_APP]: true,
});
return Promise.resolve();
Expand Down
Loading
Loading