Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
[#2003](https://github.com/plotly/dash/issues/2003) in which
`dangerously_allow_html=True` + `mathjax=True` works in some cases, and in some cases not.
- [#2047](https://github.com/plotly/dash/pull/2047) Fix bug [#1979](https://github.com/plotly/dash/issues/1979) in which `DASH_DEBUG` as enviroment variable gets ignored.
- [#2065](https://github.com/plotly/dash/pull/2065) Fix bug [#2064](https://github.com/plotly/dash/issues/2064) rendering of `dcc.Dropdown` with a value but no options.

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ const Dropdown = props => {
);

useEffect(() => {
if (optionsCheck !== sanitizedOptions && !isNil(value)) {
if (
!isNil(sanitizedOptions) &&
optionsCheck !== sanitizedOptions &&
!isNil(value)
) {
const values = sanitizedOptions.map(option => option.value);
if (multi && Array.isArray(value)) {
const invalids = value.filter(v => !values.includes(v));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,17 @@ def test_dddo002_array_comma_value(dash_dcc):
dash_dcc.wait_for_text_to_equal("#react-select-2--value-0", "San Francisco, CA\n ")

assert dash_dcc.get_logs() == []


def test_dddo003_value_no_options(dash_dcc):
app = Dash(__name__)

app.layout = html.Div(
[
dcc.Dropdown(value="foobar", id="dropdown"),
]
)

dash_dcc.start_server(app)
assert dash_dcc.get_logs() == []
dash_dcc.wait_for_element("#dropdown")