From 98a926cfcaa999e44eb3fe8376e6e04fa80fd88c Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 7 Apr 2022 12:01:05 +0200 Subject: [PATCH 1/2] Do not validate if multi-select options length is 0 --- packages/server/src/api/controllers/row/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/row/utils.js b/packages/server/src/api/controllers/row/utils.js index 9ff6b085af..9bea800d63 100644 --- a/packages/server/src/api/controllers/row/utils.js +++ b/packages/server/src/api/controllers/row/utils.js @@ -65,7 +65,10 @@ exports.validate = async ({ tableId, row, table }) => { if (type === FieldTypes.ARRAY && row[fieldName]) { if (row[fieldName].length) { row[fieldName].map(val => { - if (!constraints.inclusion.includes(val)) { + if ( + !constraints.inclusion.includes(val) && + constraints.inclusion.length !== 0 + ) { errors[fieldName] = "Field not in list" } }) From cffea09be030dd9ccbd52bd5d067eddbd60e8193 Mon Sep 17 00:00:00 2001 From: Kacper Date: Fri, 8 Apr 2022 17:21:30 +0200 Subject: [PATCH 2/2] Added option on frontend side to render MultiSelect as input instead of selector with no options --- .../src/components/backend/DataTable/RowFieldControl.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte b/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte index 7087dd0c23..ee01ef7467 100644 --- a/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte +++ b/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte @@ -34,10 +34,10 @@ $: label = meta.name ? capitalise(meta.name) : "" const timeStamp = resolveTimeStamp(value) - const isTimeStamp = timeStamp ? true : false + const isTimeStamp = !!timeStamp -{#if type === "options"} +{#if type === "options" && meta.constraints.inclusion.length !== 0}