Skip to content
Merged
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
12 changes: 12 additions & 0 deletions src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import themeColors from '../../../../styles/themes/default';
import NotFoundPage from '../../../ErrorPage/NotFoundPage';
import ValidateCodeForm from './ValidateCodeForm';
import ROUTES from '../../../../ROUTES';
import FullscreenLoadingIndicator from '../../../../components/FullscreenLoadingIndicator';

const propTypes = {
/* Onyx Props */
Expand Down Expand Up @@ -68,6 +69,9 @@ const propTypes = {
}),
}),

/** Indicated whether the report data is loading */
isLoadingReportData: PropTypes.bool,

...withLocalizePropTypes,
};

Expand All @@ -83,6 +87,7 @@ const defaultProps = {
contactMethod: '',
},
},
isLoadingReportData: true,
};

class ContactMethodDetailsPage extends Component {
Expand Down Expand Up @@ -194,6 +199,10 @@ class ContactMethodDetailsPage extends Component {
// Replacing spaces with "hard spaces" to prevent breaking the number
const formattedContactMethod = Str.isSMSLogin(contactMethod) ? this.props.formatPhoneNumber(contactMethod).replace(/ /g, '\u00A0') : contactMethod;

if (this.props.isLoadingReportData && _.isEmpty(this.props.loginList)) {
return <FullscreenLoadingIndicator />;
}

const loginData = this.props.loginList[contactMethod];
if (!contactMethod || !loginData) {
return <NotFoundPage />;
Expand Down Expand Up @@ -302,5 +311,8 @@ export default compose(
securityGroups: {
key: `${ONYXKEYS.COLLECTION.SECURITY_GROUP}`,
},
isLoadingReportData: {
key: `${ONYXKEYS.IS_LOADING_REPORT_DATA}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wrap in a string? Should we do this?

key: ONYXKEYS.IS_LOADING_REPORT_DATA,

},
}),
)(ContactMethodDetailsPage);