-
Notifications
You must be signed in to change notification settings - Fork 9.2k
aBug/10212 refactor unsafe components #10373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
71ab70c
0181ac0
2c68d82
3da2716
55bb329
f57592d
ca240bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6,7 +6,6 @@ import { fromJS } from "immutable" | |||||
const noop = ()=>{} | ||||||
|
||||||
export default class ContentType extends React.Component { | ||||||
|
||||||
static propTypes = { | ||||||
ariaControls: PropTypes.string, | ||||||
contentTypes: PropTypes.oneOfType([ImPropTypes.list, ImPropTypes.set, ImPropTypes.seq]), | ||||||
|
@@ -24,38 +23,51 @@ export default class ContentType extends React.Component { | |||||
} | ||||||
|
||||||
componentDidMount() { | ||||||
// Needed to populate the form, initially | ||||||
if(this.props.contentTypes) { | ||||||
this.props.onChange(this.props.contentTypes.first()) | ||||||
// Populate the form initially | ||||||
const { contentTypes, onChange } = this.props | ||||||
if (contentTypes && contentTypes.size) { | ||||||
onChange(contentTypes.first()) | ||||||
} | ||||||
} | ||||||
|
||||||
UNSAFE_componentWillReceiveProps(nextProps) { | ||||||
if(!nextProps.contentTypes || !nextProps.contentTypes.size) { | ||||||
componentDidUpdate(prevProps) { | ||||||
const { contentTypes, value, onChange } = this.props | ||||||
|
||||||
if (!contentTypes || !contentTypes.size) { | ||||||
return | ||||||
} | ||||||
|
||||||
if(!nextProps.contentTypes.includes(nextProps.value)) { | ||||||
nextProps.onChange(nextProps.contentTypes.first()) | ||||||
if (contentTypes !== prevProps.contentTypes || !contentTypes.includes(value)) { | ||||||
char0n marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
if (contentTypes !== prevProps.contentTypes || !contentTypes.includes(value)) { | |
if (!contentTypes.includes(value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I've made the changes and think I've removed everything unrelated to the issue.
Uh oh!
There was an error while loading. Please reload this page.