Skip to content

Commit

Permalink
FIX Console warning about required type
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabina Talipova committed Jan 11, 2024
1 parent 5db919e commit f22ce6d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions client/src/components/LinkField/LinkField.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const section = 'SilverStripe\\LinkField\\Controllers\\LinkFieldController';
const LinkField = ({
value = null,
onChange,
types = [],
types = {},
actions,
isMulti = false,
canCreate,
Expand Down Expand Up @@ -205,7 +205,7 @@ const LinkField = ({
LinkField.propTypes = {
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number]),
onChange: PropTypes.func.isRequired,
types: PropTypes.array.isRequired,
types: PropTypes.object.isRequired,
actions: PropTypes.object.isRequired,
isMulti: PropTypes.bool,
canCreate: PropTypes.bool.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/LinkField/tests/LinkField-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function makeProps(obj = {}) {
return {
value: 123,
onChange: () => {},
types: [],
types: {},
actions: {
toasts: {
success: () => {},
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/LinkPicker/LinkPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const LinkPicker = ({ types, onModalSuccess, onModalClosed, canCreate }) => {
};

LinkPicker.propTypes = {
types: PropTypes.array.isRequired,
types: PropTypes.object.isRequired,
onModalSuccess: PropTypes.func.isRequired,
onModalClosed: PropTypes.func,
canCreate: PropTypes.bool.isRequired
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/LinkPicker/tests/LinkPicker-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import LinkPicker from '../LinkPicker';

function makeProps(obj = {}) {
return {
types: [{ key: 'phone', title: 'Phone' }],
types: { phone: { key: 'phone', title: 'Phone' } },
onModalSuccess: () => {},
onModalClosed: () => {},
...obj
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/LinkModalContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const LinkModalContainer = ({ types, typeKey, linkID = 0, isOpen, onSuccess, onC
}

LinkModalContainer.propTypes = {
types: PropTypes.array.isRequired,
types: PropTypes.object.isRequired,
typeKey: PropTypes.string.isRequired,
linkID: PropTypes.number,
isOpen: PropTypes.bool.isRequired,
Expand Down
4 changes: 2 additions & 2 deletions client/src/entwine/LinkField.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jQuery.entwine('ss', ($) => {
ownerRelation: inputField.data('owner-relation'),
onChange: this.handleChange.bind(this),
isMulti: this.data('is-multi') ?? false,
types: this.data('types') ?? [],
canCreate: this.getInputField().data('can-create') ?? false,
types: this.data('types') ?? {},
canCreate: inputField.data('can-create') ? true : false,
};
},

Expand Down

0 comments on commit f22ce6d

Please sign in to comment.