From 85a86a17b387d4772ecc70d847af983c7c3c8e52 Mon Sep 17 00:00:00 2001 From: AnnMarieW Date: Fri, 4 Mar 2022 14:30:27 -0700 Subject: [PATCH 1/6] fixed dropdown bug #1908 --- .../src/fragments/Dropdown.react.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/components/dash-core-components/src/fragments/Dropdown.react.js b/components/dash-core-components/src/fragments/Dropdown.react.js index 43dd15e006..8005c4b0e8 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} from 'ramda'; +import {isNil, pluck, omit} from 'ramda'; import React, {Component} from 'react'; import ReactDropdown from 'react-virtualized-select'; import createFilterOptions from 'react-select-fast-filter-options'; @@ -21,7 +21,6 @@ const TOKENIZER = { }, }; -const DELIMITER = ','; export default class Dropdown extends Component { constructor(props) { @@ -57,12 +56,6 @@ export default class Dropdown extends Component { value, } = this.props; const {filterOptions} = this.state; - let selectedValue; - if (type(value) === 'Array') { - selectedValue = value.join(DELIMITER); - } else { - selectedValue = value; - } return (
{ if (multi) { let value; From 99e1915b6db6fbb6787dc7536552050322ef32c2 Mon Sep 17 00:00:00 2001 From: AnnMarieW Date: Fri, 4 Mar 2022 14:47:12 -0700 Subject: [PATCH 2/6] CHANGELOG --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce89761e4a..f26043b989 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed - [#1953](https://github.com/plotly/dash/pull/1953) Fix bug [#1783](https://github.com/plotly/dash/issues/1783) in which a failed hot reloader blocks the UI with alerts. + +## Dash Core Components + +### Fixed +- [#1958](https://github.com/plotly/dash/pull/1958) Fix dropdown bug [#1908](https://github.com/plotly/dash/issues/1908) where the value didn't display in the input box if it contained a comma. + + ## [2.2.0] - 2022-02-18 ### Added @@ -92,7 +99,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). [#1894](https://github.com/plotly/dash/pull/1894) restricted this feature so auto-generated IDs are not allowed if the app uses `dash_snapshots` (a Dash Enterprise package) or if the component uses `persistence`, as this can create confusing errors. Callback definitions can still reference components in these cases, but those components must have explicit IDs. ## Dash Core Components - + ### Rearranged Keyword Arguments & Flexible Types **`Dropdown`, `RadioItem`, and `Checklist`** - Rearranged Keyword Arguments - `options` & `value` are now the first two keywords which means they can be supplied as positional arguments without the keyword. Supplying the keywords (`options=` and `value=`) is still supported. From 9bf8b2fa4e8ca01b448e4ddfb1fa8cbeb704f9ae Mon Sep 17 00:00:00 2001 From: AnnMarieW Date: Fri, 4 Mar 2022 15:55:27 -0700 Subject: [PATCH 3/6] lint --- components/dash-core-components/src/fragments/Dropdown.react.js | 1 - 1 file changed, 1 deletion(-) diff --git a/components/dash-core-components/src/fragments/Dropdown.react.js b/components/dash-core-components/src/fragments/Dropdown.react.js index 8005c4b0e8..1ee7dab49f 100644 --- a/components/dash-core-components/src/fragments/Dropdown.react.js +++ b/components/dash-core-components/src/fragments/Dropdown.react.js @@ -21,7 +21,6 @@ const TOKENIZER = { }, }; - export default class Dropdown extends Component { constructor(props) { super(props); From 8d1adbe9ad11a893f155bd66e8d70a71a4085133 Mon Sep 17 00:00:00 2001 From: AnnMarieW Date: Sat, 5 Mar 2022 15:27:50 -0700 Subject: [PATCH 4/6] removed unnecessary test --- .../dropdown/test_dynamic_options.py | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/components/dash-core-components/tests/integration/dropdown/test_dynamic_options.py b/components/dash-core-components/tests/integration/dropdown/test_dynamic_options.py index 85d9985579..fd4d00560e 100644 --- a/components/dash-core-components/tests/integration/dropdown/test_dynamic_options.py +++ b/components/dash-core-components/tests/integration/dropdown/test_dynamic_options.py @@ -1,4 +1,4 @@ -from dash import Dash, Input, Output, dcc, html +from dash import Dash, Input, Output, dcc from dash.exceptions import PreventUpdate @@ -51,26 +51,3 @@ def update_options(search_value): assert options[0].text == "Montreal" assert dash_dcc.get_logs() == [] - - -def test_dddo002_array_value(dash_dcc): - dropdown_options = [ - {"label": "New York City", "value": "New,York,City"}, - {"label": "Montreal", "value": "Montreal"}, - {"label": "San Francisco", "value": "San,Francisco"}, - ] - - app = Dash(__name__) - arrayValue = ["San", "Francisco"] - - dropdown = dcc.Dropdown( - options=dropdown_options, - value=arrayValue, - ) - app.layout = html.Div([dropdown]) - - dash_dcc.start_server(app) - - dash_dcc.wait_for_text_to_equal("#react-select-2--value-item", "San Francisco") - - assert dash_dcc.get_logs() == [] From 29332ac8c30559490d4e00b48c0f211d5b919ec4 Mon Sep 17 00:00:00 2001 From: AnnMarieW Date: Sun, 13 Mar 2022 19:55:34 -0700 Subject: [PATCH 5/6] added test --- .../dropdown/test_dynamic_options.py | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/components/dash-core-components/tests/integration/dropdown/test_dynamic_options.py b/components/dash-core-components/tests/integration/dropdown/test_dynamic_options.py index fd4d00560e..eebf3b6f3e 100644 --- a/components/dash-core-components/tests/integration/dropdown/test_dynamic_options.py +++ b/components/dash-core-components/tests/integration/dropdown/test_dynamic_options.py @@ -1,4 +1,4 @@ -from dash import Dash, Input, Output, dcc +from dash import Dash, Input, Output, dcc, html from dash.exceptions import PreventUpdate @@ -51,3 +51,21 @@ def update_options(search_value): assert options[0].text == "Montreal" assert dash_dcc.get_logs() == [] + + +def test_dddo002_array_value(dash_dcc): + + app = Dash(__name__) + + dropdown = dcc.Dropdown( + options=["New York, NY", "Montreal, QC", "San Francisco, CA"], + value=["San Francisco, CA"], + multi=True, + ) + app.layout = html.Div(dropdown) + + dash_dcc.start_server(app) + + dash_dcc.wait_for_text_to_equal("#react-select-2--value-0", "San Francisco, CA\n ") + + assert dash_dcc.get_logs() == [] From 124448f72e013b5da2b2a4f7b42037ba253d4810 Mon Sep 17 00:00:00 2001 From: AnnMarieW Date: Sun, 13 Mar 2022 20:14:31 -0700 Subject: [PATCH 6/6] updated CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bef59a2111..1bec144b99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed + +### Fixed +- [#1958](https://github.com/plotly/dash/pull/1958) Fix dropdown bug [#1908](https://github.com/plotly/dash/issues/1908) where the value didn't display in the input box if it contained a comma. - [#1915](https://github.com/plotly/dash/pull/1915) Fix bug [#1474](https://github.com/plotly/dash/issues/1474) when both dcc.Graph and go.Figure have animation, and when the second animation in Figure is executed, the Frames from the first animation are played instead of the second one. - [#1953](https://github.com/plotly/dash/pull/1953) Fix bug [#1783](https://github.com/plotly/dash/issues/1783) in which a failed hot reloader blocks the UI with alerts.