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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
17 changes: 0 additions & 17 deletions src/libs/PersonalDetailsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -451,7 +435,6 @@ export {
getNewAccountIDsAndLogins,
getUserNameByEmail,
getShortMentionIfFound,
getDefaultCountry,
getLoginByAccountID,
getPhoneNumber,
};
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -25,11 +27,14 @@ function updateAddress(values: FormOnyxValues<typeof ONYXKEYS.FORMS.HOME_ADDRESS

function PersonalAddressPage() {
const {translate} = useLocalize();
const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS);
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);
const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS, {canBeMissing: true});
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP, {canBeMissing: true});
const [defaultCountry, defaultCountryStatus] = useOnyx(ONYXKEYS.COUNTRY, {canBeMissing: true});
const isLoading = isLoadingOnyxValue(defaultCountryStatus);
const address = useMemo(() => getCurrentAddress(privatePersonalDetails), [privatePersonalDetails]);
const defaultCountry = getDefaultCountry();

if (isLoading) {
return <FullScreenLoadingIndicator />;
}
return (
<AddressPage
defaultCountry={defaultCountry as Country}
Expand Down