Skip to content

Commit eb69078

Browse files
authored
Merge pull request #3656 from plotly/bugfix/3616
dcc.Dropdown: Use virtualized lists for large collections of options
2 parents 1c10c88 + 9fcf650 commit eb69078

File tree

16 files changed

+530
-343
lines changed

16 files changed

+530
-343
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1010
## Fixed
1111
- [#3629](https://github.com/plotly/dash/pull/3629) Fix date pickers not showing date when initially rendered in a hidden container.
1212
- [#3627][(](https://github.com/plotly/dash/pull/3627)) Make dropdowns searchable wheen focused, without requiring to open them first
13+
- [#3656][(](https://github.com/plotly/dash/pull/3656)) Improved dropdown performance for large collections of options
1314
- [#3660][(](https://github.com/plotly/dash/pull/3660)) Allow same date to be selected for both start and end in DatePickerRange components
1415

1516

components/dash-core-components/package-lock.json

Lines changed: 30 additions & 94 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/dash-core-components/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@
4747
"@radix-ui/react-tooltip": "^1.2.8",
4848
"base64-js": "^1.5.1",
4949
"d3-format": "^1.4.5",
50+
"date-fns": "^4.1.0",
5051
"fast-isnumeric": "^1.1.4",
5152
"file-saver": "^2.0.5",
5253
"highlight.js": "^11.8.0",
5354
"js-search": "^2.0.1",
5455
"mathjax": "^3.2.2",
55-
"date-fns": "^4.1.0",
5656
"node-polyfill-webpack-plugin": "^2.0.1",
5757
"prop-types": "^15.8.1",
5858
"ramda": "^0.30.1",
@@ -62,7 +62,7 @@
6262
"react-fast-compare": "^3.2.2",
6363
"react-input-autosize": "^3.0.0",
6464
"react-markdown": "^4.3.1",
65-
"react-virtualized-select": "^3.1.3",
65+
"react-window": "^1.8.11",
6666
"remark-math": "^3.0.1",
6767
"uniqid": "^5.4.0"
6868
},
@@ -86,6 +86,7 @@
8686
"@types/react": "^16.14.8",
8787
"@types/react-dom": "^16.9.13",
8888
"@types/react-input-autosize": "^2.2.4",
89+
"@types/react-window": "^1.8.8",
8990
"@types/uniqid": "^5.3.4",
9091
"@typescript-eslint/eslint-plugin": "^5.59.7",
9192
"@typescript-eslint/parser": "^5.59.7",

components/dash-core-components/src/components/Checklist.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function Checklist({
3030
inline = false,
3131
}: ChecklistProps) {
3232
const sanitizedOptions = useMemo(() => {
33-
return sanitizeOptions(options);
33+
return sanitizeOptions(options).options;
3434
}, [options]);
3535

3636
const stylingProps = {

components/dash-core-components/src/components/RadioItems.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function RadioItems({
3131
inline = false,
3232
}: RadioItemsProps) {
3333
const sanitizedOptions = useMemo(() => {
34-
return sanitizeOptions(options);
34+
return sanitizeOptions(options).options;
3535
}, [options]);
3636

3737
const stylingProps = {

components/dash-core-components/src/components/css/dropdown.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,18 @@
218218
overflow-y: auto;
219219
}
220220

221+
.dash-dropdown-content:has(.dash-options-list-virtualized) {
222+
overflow-y: hidden;
223+
display: flex;
224+
flex-direction: column;
225+
}
226+
227+
.dash-dropdown-options:has(.dash-options-list-virtualized) {
228+
overflow-y: visible;
229+
flex: 1;
230+
min-height: 0;
231+
}
232+
221233
.dash-dropdown-option {
222234
padding: calc(var(--Dash-Spacing) * 2) calc(var(--Dash-Spacing) * 3);
223235
box-shadow: 0 -1px 0 0 var(--Dash-Fill-Disabled) inset;

0 commit comments

Comments
 (0)