From 71284e2fc99ac1787f92ccbda8667af149f56b22 Mon Sep 17 00:00:00 2001 From: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com> Date: Sun, 27 Mar 2022 07:06:34 +0100 Subject: [PATCH] fix: add default error message --- .../src/widgets/MultiSelectWidgetV2/widget/index.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx b/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx index 08ff79d45e..cb05cce6c7 100644 --- a/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx +++ b/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx @@ -26,6 +26,9 @@ export function defaultOptionValueValidation( let parsed: any[] = []; let message = ""; + const DEFAULT_ERROR_MESSAGE = + "value should match: Array | Array<{label: string, value: string | number}>"; + /* * Function to check if the object has `label` and `value` */ @@ -102,8 +105,7 @@ export function defaultOptionValueValidation( * When value is [true, false], [undefined, undefined] etc. */ parsed = []; - message = - "value should match: Array | Array<{label: string, value: string | number}>"; + message = DEFAULT_ERROR_MESSAGE; } return { @@ -130,8 +132,7 @@ export function defaultOptionValueValidation( * When value is undefined, null, {} etc. */ parsed = []; - message = - "value should match: Array | Array<{label: string, value: string | number}>"; + message = DEFAULT_ERROR_MESSAGE; } return {