diff --git a/app/gabsocial/features/edit_profile/index.js b/app/gabsocial/features/edit_profile/index.js index a57da8b36..eea420962 100644 --- a/app/gabsocial/features/edit_profile/index.js +++ b/app/gabsocial/features/edit_profile/index.js @@ -115,18 +115,20 @@ class EditProfile extends ImmutablePureComponent { event.preventDefault(); } - componentWillMount() { - const { account } = this.props; - const sourceData = account.get('source'); - const accountData = account.merge(sourceData).delete('source'); - const fields = normalizeFields(accountData.get('fields')); - const initialState = unescapeParams( - accountData.set('fields', fields), - ['display_name', 'note'] - ); + setInitialState = () => { + const initialState = this.props.account.withMutations(map => { + map.merge(map.get('source')); + map.delete('source'); + map.set('fields', normalizeFields(map.get('fields'))); + unescapeParams(map, ['display_name', 'note']); + }); this.setState(initialState.toObject()); } + componentWillMount() { + this.setInitialState(); + } + handleCheckboxChange = e => { this.setState({ [e.target.name]: e.target.checked }); }