Skip to content

Commit

Permalink
Merge pull request #22988 from hungvu193/fix-22120
Browse files Browse the repository at this point in the history
fix Notfound when login from contact detail page
  • Loading branch information
Joel Bettner authored Jul 18, 2023
2 parents bc44a3f + 2e922f6 commit 21d14c5
Showing 1 changed file with 12 additions and 0 deletions.
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}`,
},
}),
)(ContactMethodDetailsPage);

0 comments on commit 21d14c5

Please sign in to comment.