-
Notifications
You must be signed in to change notification settings - Fork 96
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
FIX JS Console errors and warnings #1698
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,12 +166,12 @@ SearchableDropdownField.propTypes = { | |
multi: PropTypes.bool.isRequired, | ||
name: PropTypes.string.isRequired, | ||
placeholder: PropTypes.string.isRequired, | ||
onChange: PropTypes.func.isRequired, | ||
onChange: PropTypes.func, | ||
options: PropTypes.arrayOf(PropTypes.object), | ||
optionUrl: PropTypes.string, | ||
passRef: PropTypes.bool.isRequired, | ||
searchable: PropTypes.bool.isRequired, | ||
value: PropTypes.any.isRequired, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here as well. We don't have any values in a new field and pass |
||
value: PropTypes.any, | ||
SelectComponent: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired, | ||
AsyncSelectComponent: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired, | ||
}; | ||
|
@@ -184,6 +184,8 @@ SearchableDropdownField.defaultProps = { | |
multi: false, | ||
passRef: true, | ||
placeholder: '', | ||
onChange: () => {}, | ||
value: '', | ||
SelectComponent: Select, | ||
AsyncSelectComponent: AsyncSelect, | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,18 +13,22 @@ window.jQuery.entwine('ss', ($) => { | |
const cmsContent = this.closest('.cms-content').attr('id'); | ||
const context = cmsContent ? { context: cmsContent } : {}; | ||
const schema = this.data('schema'); | ||
this.data('entwine-value', schema.value); | ||
const Root = createRoot(this[0]); | ||
const ReactField = loadComponent(schema.component, context); | ||
this.setRoot(Root); | ||
this.setComponent(ReactField); | ||
this._super(); | ||
this.refresh(); | ||
if (schema) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In first load Entwine |
||
this.data('entwine-value', schema.value); | ||
const Root = createRoot(this[0]); | ||
const ReactField = loadComponent(schema.component, context); | ||
this.setRoot(Root); | ||
this.setComponent(ReactField); | ||
this._super(); | ||
this.refresh(); | ||
} | ||
}, | ||
|
||
onunmatch() { | ||
const Root = this.getRoot(); | ||
Root.unmount(); | ||
if (Root) { | ||
Root.unmount(); | ||
} | ||
}, | ||
|
||
getProps() { | ||
|
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.
I don't think that this method is always required. This recommendation gives advice to use
defaultProps
instead ofisRequired
if we are not sure that this value will be provided.