From 5fad0eb5c20bfb21960df5595ca40716ee652efd Mon Sep 17 00:00:00 2001 From: Suren Date: Thu, 14 Nov 2024 11:53:38 +0530 Subject: [PATCH] update new option func --- .../components/SelectInfiniteScroll/SelectInfiniteScroll.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/geonode_mapstore_client/client/js/components/SelectInfiniteScroll/SelectInfiniteScroll.jsx b/geonode_mapstore_client/client/js/components/SelectInfiniteScroll/SelectInfiniteScroll.jsx index db3c6f4c66..4c4e201f84 100644 --- a/geonode_mapstore_client/client/js/components/SelectInfiniteScroll/SelectInfiniteScroll.jsx +++ b/geonode_mapstore_client/client/js/components/SelectInfiniteScroll/SelectInfiniteScroll.jsx @@ -47,7 +47,7 @@ function SelectInfiniteScroll({ const updateNewOption = (newOptions, query) => { if (props.creatable && !isEmpty(query)) { const isValueExist = props.value?.some(v => v[labelKey] === query); - const isOptionExist = newOptions.some((option) => option.label === query); + const isOptionExist = newOptions.some((o) => o[labelKey] === query); // Add new option if it doesn't exist and `creatable` is enabled if (!isValueExist && !isOptionExist) { @@ -56,6 +56,7 @@ function SelectInfiniteScroll({ result: { [valueKey]: query, [labelKey]: query } }].concat(newOptions); } + return newOptions; } return newOptions; };