From a83f785b73f2996b7f6673a52c981f01ea49da4e Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 4 Jul 2020 19:32:07 -0500 Subject: [PATCH] React 17.x upgrade fixes --- .../compose/components/privacy_dropdown.js | 2 +- app/soapbox/features/edit_profile/index.js | 22 +++++++++---------- app/soapbox/features/groups/create/index.js | 2 +- app/soapbox/features/introduction/index.js | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/soapbox/features/compose/components/privacy_dropdown.js b/app/soapbox/features/compose/components/privacy_dropdown.js index d980c715b..d024b68e5 100644 --- a/app/soapbox/features/compose/components/privacy_dropdown.js +++ b/app/soapbox/features/compose/components/privacy_dropdown.js @@ -170,7 +170,7 @@ class PrivacyDropdown extends React.PureComponent { constructor(props) { super(props); - const { intl: { formatMessage } } = this.props; + const { intl: { formatMessage } } = props; this.options = [ { icon: 'globe', value: 'public', text: formatMessage(messages.public_short), meta: formatMessage(messages.public_long) }, diff --git a/app/soapbox/features/edit_profile/index.js b/app/soapbox/features/edit_profile/index.js index dde0d5e5c..02972cb6d 100644 --- a/app/soapbox/features/edit_profile/index.js +++ b/app/soapbox/features/edit_profile/index.js @@ -64,6 +64,17 @@ class EditProfile extends ImmutablePureComponent { fields: normalizeFields(Array.from({ length: MAX_FIELDS })), } + constructor(props) { + super(props); + const initialState = 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.state = initialState.toObject(); + } + makePreviewAccount = () => { const { account } = this.props; return account.merge(ImmutableMap({ @@ -117,17 +128,6 @@ class EditProfile extends ImmutablePureComponent { event.preventDefault(); } - constructor(props) { - super(props); - 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.state = initialState.toObject(); - } - handleCheckboxChange = e => { this.setState({ [e.target.name]: e.target.checked }); } diff --git a/app/soapbox/features/groups/create/index.js b/app/soapbox/features/groups/create/index.js index 5bf9b50f4..20d5add35 100644 --- a/app/soapbox/features/groups/create/index.js +++ b/app/soapbox/features/groups/create/index.js @@ -51,7 +51,7 @@ class Create extends React.PureComponent { constructor(props) { super(props); - this.props.reset(); + props.reset(); } handleTitleChange = e => { diff --git a/app/soapbox/features/introduction/index.js b/app/soapbox/features/introduction/index.js index 2ac40a865..55408ceef 100644 --- a/app/soapbox/features/introduction/index.js +++ b/app/soapbox/features/introduction/index.js @@ -87,7 +87,7 @@ class Introduction extends React.PureComponent { constructor(props) { super(props); this.pages = [ - , + , , , ];