Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed dropdown bug #1908 #1958

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 2 additions & 10 deletions components/dash-core-components/src/fragments/Dropdown.react.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -21,8 +21,6 @@ const TOKENIZER = {
},
};

const DELIMITER = ',';

export default class Dropdown extends Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -57,12 +55,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 (
<div
id={id}
Expand All @@ -75,7 +67,7 @@ export default class Dropdown extends Component {
<ReactDropdown
filterOptions={filterOptions}
options={sanitizeOptions(options)}
value={selectedValue}
value={value}
onChange={selectedOption => {
if (multi) {
let value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,18 @@ def update_options(search_value):


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,
options=["New York, NY", "Montreal, QC", "San Francisco, CA"],
value=["San Francisco, CA"],
multi=True,
)
app.layout = html.Div([dropdown])
app.layout = html.Div(dropdown)

dash_dcc.start_server(app)

dash_dcc.wait_for_text_to_equal("#react-select-2--value-item", "San Francisco")
dash_dcc.wait_for_text_to_equal("#react-select-2--value-0", "San Francisco, CA\n ")

assert dash_dcc.get_logs() == []