Skip to content

Commit 9c832e7

Browse files
committed
fix: Title is displayed as 'Welcome to undefined'
- don't show incomplete profile for project if user cannot load project by any reason - don't try to submit incomplete profile on load to avoid showing error alert ref issue #4157
1 parent 79a72a2 commit 9c832e7

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/projects/detail/ProjectDetail.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,12 @@ class ProjectDetail extends Component {
200200
}
201201
}
202202

203-
// as soon as user profile settings are loaded, check if all required fields are completed or show the popup
204-
if (this.props.profileSettings.isLoading && !profileSettings.isLoading && !isUserProfileComplete(nextProps.currentUser, profileSettings.settings)) {
203+
// as soon as user profile settings and project are both loaded, check if all required fields are completed or show the popup
204+
const profileSettingsJustLoaded = this.props.profileSettings.isLoading && !profileSettings.isLoading
205+
const projectJustLoaded = this.props.isLoading && !isLoading
206+
const timeToShowIncompleteProfile = !profileSettings.isLoading && !isLoading && (profileSettingsJustLoaded || projectJustLoaded)
207+
const projectLoadingError = nextProps.error && (nextProps.error.type === LOAD_PROJECT_FAILURE || nextProps.error.type === ACCEPT_OR_REFUSE_INVITE_FAILURE)
208+
if ( !projectLoadingError && timeToShowIncompleteProfile && !isUserProfileComplete(nextProps.currentUser, profileSettings.settings)) {
205209
this.setState({ showIncompleteProfilePopup: true })
206210
}
207211

src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ class ProfileSettingsForm extends Component {
4747
}
4848

4949
componentDidUpdate() {
50+
// if we want to show validation errors on form showing
5051
if (this.refs.form && !this.isValidated && this.props.shouldDoValidateOnStart) {
51-
this.refs.form.submit()
52+
// we have to mark the form as not pristine, so validation errors are shown
53+
this.refs.form.setFormPristine(false)
5254
this.isValidated = true
5355
}
5456
}
@@ -423,7 +425,7 @@ ProfileSettingsForm.defaultProps = {
423425
ProfileSettingsForm.propTypes = {
424426
values: PropTypes.object.isRequired,
425427
saveSettings: PropTypes.func.isRequired,
426-
uploadPhoto: PropTypes.func.isRequired,
428+
uploadPhoto: PropTypes.func,
427429
fieldsConfig: PropTypes.shape({
428430
avatar: PropTypes.bool,
429431
firstName: PropTypes.bool,

0 commit comments

Comments
 (0)