diff --git a/package.json b/package.json index e9a1fd1d3576..569a3db205d8 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand", "perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure", "typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc", - "lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=250 --cache --cache-location=node_modules/.cache/eslint", + "lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=249 --cache --cache-location=node_modules/.cache/eslint", "lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh", "lint-watch": "npx eslint-watch --watch --changed", "shellcheck": "./scripts/shellCheck.sh", diff --git a/src/libs/PersonalDetailsUtils.ts b/src/libs/PersonalDetailsUtils.ts index 0eec8cbed3ca..52360cc79d60 100644 --- a/src/libs/PersonalDetailsUtils.ts +++ b/src/libs/PersonalDetailsUtils.ts @@ -50,18 +50,6 @@ Onyx.connect({ }, }); -let defaultCountry = ''; - -Onyx.connect({ - key: ONYXKEYS.COUNTRY, - callback: (value) => { - if (!value) { - return; - } - defaultCountry = value; - }, -}); - const regexMergedAccount = new RegExp(CONST.REGEX.MERGED_ACCOUNT_PREFIX); function getDisplayNameOrDefault( @@ -414,10 +402,6 @@ const getShortMentionIfFound = (displayText: string, userAccountID: string, curr return displayText.split('@').at(0); }; -function getDefaultCountry() { - return defaultCountry; -} - /** * Gets the phone number to display for SMS logins */ @@ -451,7 +435,6 @@ export { getNewAccountIDsAndLogins, getUserNameByEmail, getShortMentionIfFound, - getDefaultCountry, getLoginByAccountID, getPhoneNumber, }; diff --git a/src/pages/settings/Profile/PersonalDetails/PersonalAddressPage.tsx b/src/pages/settings/Profile/PersonalDetails/PersonalAddressPage.tsx index bbaf785c7ba8..4b6e89f065eb 100644 --- a/src/pages/settings/Profile/PersonalDetails/PersonalAddressPage.tsx +++ b/src/pages/settings/Profile/PersonalDetails/PersonalAddressPage.tsx @@ -1,12 +1,14 @@ import React, {useMemo} from 'react'; +import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; -import {getCurrentAddress, getDefaultCountry} from '@libs/PersonalDetailsUtils'; +import {getCurrentAddress} from '@libs/PersonalDetailsUtils'; import AddressPage from '@pages/AddressPage'; import type {FormOnyxValues} from '@src/components/Form/types'; import type {Country} from '@src/CONST'; import {updateAddress as updateAddressPersonalDetails} from '@src/libs/actions/PersonalDetails'; import ONYXKEYS from '@src/ONYXKEYS'; +import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; /** * Submit form to update user's first and last legal name @@ -25,11 +27,14 @@ function updateAddress(values: FormOnyxValues getCurrentAddress(privatePersonalDetails), [privatePersonalDetails]); - const defaultCountry = getDefaultCountry(); - + if (isLoading) { + return ; + } return (