Skip to content

Commit

Permalink
FIX JS Console errors and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabina Talipova committed Mar 4, 2024
1 parent 0c5de61 commit 1df1ee7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
value: PropTypes.any,
SelectComponent: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired,
AsyncSelectComponent: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired,
};
Expand All @@ -184,6 +184,8 @@ SearchableDropdownField.defaultProps = {
multi: false,
passRef: true,
placeholder: '',
onChange: () => {},
value: '',
SelectComponent: Select,
AsyncSelectComponent: AsyncSelect,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
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() {
Expand Down

0 comments on commit 1df1ee7

Please sign in to comment.