From a5eef680618ccd03b25a4016a7e918b935bd685d Mon Sep 17 00:00:00 2001 From: philippe Date: Tue, 15 Mar 2022 13:45:04 -0400 Subject: [PATCH] Fix Dropdown comma in value. #1908 --- .../src/fragments/Dropdown.react.js | 15 ++++----------- .../dropdown/test_dynamic_options.py | 18 ++++++------------ 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/components/dash-core-components/src/fragments/Dropdown.react.js b/components/dash-core-components/src/fragments/Dropdown.react.js index 1f41d61cd7..599610dfc1 100644 --- a/components/dash-core-components/src/fragments/Dropdown.react.js +++ b/components/dash-core-components/src/fragments/Dropdown.react.js @@ -1,4 +1,4 @@ -import {isNil, pluck, omit, type, without} from 'ramda'; +import {isNil, pluck, omit, without} from 'ramda'; import React, {useState, useCallback, useEffect, useMemo} from 'react'; import ReactDropdown from 'react-virtualized-select'; import createFilterOptions from 'react-select-fast-filter-options'; @@ -21,8 +21,6 @@ const TOKENIZER = { }, }; -const DELIMITER = ','; - const Dropdown = props => { const { id, @@ -46,11 +44,6 @@ const Dropdown = props => { ]; }, [options]); - const selectedValue = useMemo( - () => (type(value) === 'Array' ? value.join(DELIMITER) : value), - [value] - ); - const onChange = useCallback( selectedOption => { if (multi) { @@ -88,13 +81,13 @@ const Dropdown = props => { setProps({value: without(invalids, value)}); } } else { - if (!values.includes(selectedValue)) { + if (!values.includes(value)) { setProps({value: null}); } } setOptionsCheck(sanitizedOptions); } - }, [sanitizedOptions, optionsCheck, multi, value, selectedValue]); + }, [sanitizedOptions, optionsCheck, multi, value]); return (
{