Skip to content

Commit e5cfa57

Browse files
committed
Address code review feedback
1 parent 0198e20 commit e5cfa57

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

5+
## UNRELEASED
6+
7+
## Fixed
8+
9+
- [#2593](https://github.com/plotly/dash/pull/2593) dcc.Input accepts a number for its debounce argument
10+
511
## [2.11.1] - 2023-06-29
612

713
## Fixed

components/dash-core-components/.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
}],
118118
"no-magic-numbers": ["error", {
119119
"ignoreArrayIndexes": true,
120-
"ignore": [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 10, 16, 0.5, 25]
120+
"ignore": [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 10, 16, 0.5, 25, 1000]
121121
}],
122122
"no-underscore-dangle": ["off"],
123123
"no-useless-escape": ["off"]

components/dash-core-components/src/components/Input.react.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,13 @@ export default class Input extends PureComponent {
134134
this.setState({pendingEvent: undefined});
135135
}
136136

137-
debounceEvent(time = 0.5) {
137+
debounceEvent(seconds = 0.5) {
138138
const {value} = this.input.current;
139-
const MILLISECONDS = 1000;
140-
time = time * MILLISECONDS;
141139

142140
window.clearTimeout(this.state?.pendingEvent);
143141
const pendingEvent = window.setTimeout(() => {
144142
this.onEvent();
145-
}, time);
143+
}, seconds * 1000);
146144

147145
this.setState({
148146
value,

components/dash-core-components/tests/integration/input/test_debounce.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_debounce_text_by_time(dash_dcc, debounce_text_app):
1616
)
1717

1818
# but do expect that it is eventually called
19-
assert dash_dcc.wait_for_text_to_equal(
19+
dash_dcc.wait_for_text_to_equal(
2020
"#div-slow", "unit test slow"
2121
), "long debounce is eventually called back"
2222

@@ -42,7 +42,7 @@ def test_debounce_number_by_time(dash_dcc, debounce_number_app):
4242
)
4343

4444
# but do expect that it is eventually called
45-
assert dash_dcc.wait_for_text_to_equal(
45+
dash_dcc.wait_for_text_to_equal(
4646
"#div-slow", "12345"
4747
), "long debounce is eventually called back"
4848

0 commit comments

Comments
 (0)