From 3f7e4187cc6e8dfda218424be1d01c7d4d411b4f Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Fri, 30 Sep 2022 22:45:09 -0400 Subject: [PATCH] Fix relation validation --- src/widgets/relation/RelationControl.js | 2 +- src/widgets/relation/index.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/widgets/relation/RelationControl.js b/src/widgets/relation/RelationControl.js index 71c58d85..73580ef0 100644 --- a/src/widgets/relation/RelationControl.js +++ b/src/widgets/relation/RelationControl.js @@ -9,7 +9,7 @@ import { FixedSizeList } from 'react-window'; import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc'; import { reactSelectStyles } from '../../ui'; -import { stringTemplate, validations } from '../../lib/widgets'; +import { stringTemplate } from '../../lib/widgets'; function arrayMove(array, from, to) { const slicedArray = array.slice(); diff --git a/src/widgets/relation/index.js b/src/widgets/relation/index.js index b44ef634..6b4a8a32 100644 --- a/src/widgets/relation/index.js +++ b/src/widgets/relation/index.js @@ -1,6 +1,11 @@ import controlComponent from './RelationControl'; import previewComponent from './RelationPreview'; import schema from './schema'; +import { validations } from '../../lib/widgets'; + +function isMultiple(field) { + return field.get('multiple', false); +} function Widget(opts = {}) { return { @@ -11,7 +16,7 @@ function Widget(opts = {}) { const min = field.get('min'); const max = field.get('max'); - if (!this.isMultiple()) { + if (!isMultiple(field)) { return { error: false }; }