mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 11:39:28 +08:00
Merge pull request #16081 from raybooysen/fix/cancelExistingDebounce
fix: If there is an existing debounce in progress, cancel that
This commit is contained in:
commit
321a12eb6c
@ -98,6 +98,10 @@ class Spin extends React.Component<SpinProps, SpinState> {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.cancelExistingSpin();
|
||||
}
|
||||
|
||||
cancelExistingSpin() {
|
||||
const updateSpinning: any = this.updateSpinning;
|
||||
if (updateSpinning && updateSpinning.cancel) {
|
||||
updateSpinning.cancel();
|
||||
@ -116,6 +120,7 @@ class Spin extends React.Component<SpinProps, SpinState> {
|
||||
debouncifyUpdateSpinning = (props?: SpinProps) => {
|
||||
const { delay } = props || this.props;
|
||||
if (delay) {
|
||||
this.cancelExistingSpin();
|
||||
this.updateSpinning = debounce(this.originalUpdateSpinning, delay);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user