Skip to content

Commit 4abc8ea

Browse files
committed
onChange only trigger when current not same
1 parent 6e21748 commit 4abc8ea

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

examples/simple.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const ControlSteps = () => {
1313
<Steps
1414
current={current}
1515
onChange={(val) => {
16+
console.log('Change:', val);
1617
setCurrent(val);
1718
}}
1819
>

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rc-steps",
3-
"version": "3.4.0",
3+
"version": "3.4.1",
44
"description": "steps ui component for react",
55
"keywords": [
66
"react",

src/Steps.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ export default class Steps extends Component {
6868
}
6969
}
7070

71-
onStepClick = (current) => {
72-
const { onChange } = this.props;
73-
if (onChange) {
74-
onChange(current);
71+
onStepClick = (next) => {
72+
const { onChange, current } = this.props;
73+
if (onChange && current !== next) {
74+
onChange(next);
7575
}
7676
};
7777

0 commit comments

Comments
 (0)