From 922545096a578ede49b09a4f6977d0c108305bef Mon Sep 17 00:00:00 2001 From: eilenexuzhe Date: Thu, 2 Apr 2020 16:59:38 +0800 Subject: [PATCH] fix: setTimout problem --- console/src/container/cluster-topic/index.tsx | 6 +++--- console/src/container/drawer/reset-offset.tsx | 4 ++-- console/src/container/modal/topic-new.tsx | 2 +- console/src/store/cluster.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/console/src/container/cluster-topic/index.tsx b/console/src/container/cluster-topic/index.tsx index 89859310..cde5193b 100644 --- a/console/src/container/cluster-topic/index.tsx +++ b/console/src/container/cluster-topic/index.tsx @@ -49,14 +49,14 @@ export class SearchAndFilter extends React.Component { } public handleVisble = (type: string) => { - if (this.timer) clearTimeout(this.timer); - setTimeout(() => { + if (this.timer) window.clearTimeout(this.timer); + window.setTimeout(() => { this.setState({ [type]: true }); }); } public handleUnVisble = (type: string) => { - this.timer = setTimeout(() => { + this.timer = window.setTimeout(() => { this.setState({ [type]: false }); }, 100); } diff --git a/console/src/container/drawer/reset-offset.tsx b/console/src/container/drawer/reset-offset.tsx index dafeaac1..f9690045 100644 --- a/console/src/container/drawer/reset-offset.tsx +++ b/console/src/container/drawer/reset-offset.tsx @@ -19,7 +19,7 @@ class ResetOffset extends React.Component { consume.offsetPartition(Object.assign({ timestamp: +moment(timestamp).format('x') }, topic.currentGroup)) .then(() => { message.success('重置时间成功'); - setTimeout(() => { + window.setTimeout(() => { location.reload(); }, 200); }); @@ -28,7 +28,7 @@ class ResetOffset extends React.Component { public submitPartiton = () => { consume.offsetPartition(topic.currentGroup, 1).then(() => { message.success('重置分区成功'); - setTimeout(() => { + window.setTimeout(() => { location.reload(); }, 200); }); diff --git a/console/src/container/modal/topic-new.tsx b/console/src/container/modal/topic-new.tsx index 27ccdf74..813d5040 100644 --- a/console/src/container/modal/topic-new.tsx +++ b/console/src/container/modal/topic-new.tsx @@ -36,7 +36,7 @@ class Topic extends React.Component { this.setState({ loading: true }); createTopic(values).then(data => { notification.success({ message: '申请Topic成功' }); - setTimeout(() => location.assign('/user/my_order'), 500); + window.setTimeout(() => location.assign('/user/my_order'), 500); modal.close(); }, (err) => { this.setState({ loading: false }); diff --git a/console/src/store/cluster.ts b/console/src/store/cluster.ts index 39777fbc..34e957bd 100644 --- a/console/src/store/cluster.ts +++ b/console/src/store/cluster.ts @@ -111,7 +111,7 @@ class Cluster { return getRebalanceStatus(clusterId).then((type) => { this.setLeaderStatus(type); if (type === 'RUNNING') { - setTimeout(() => { + window.setTimeout(() => { this.getRebalance(clusterId); }, 1000 * 2); }