From 7c18b657116b4b679104d840d23864e4a0f3e02d Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 1 Sep 2018 23:35:09 +0800 Subject: [PATCH] tweak loading timeout --- src/pages/Dashboard/Analysis.js | 5 +++-- src/pages/Dashboard/Monitor.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index 8f87c575..e0be87b2 100644 --- a/src/pages/Dashboard/Analysis.js +++ b/src/pages/Dashboard/Analysis.js @@ -78,11 +78,11 @@ class Analysis extends Component { dispatch({ type: 'chart/fetch', }); - setTimeout(() => { + this.timeoutId = setTimeout(() => { this.setState({ loading: false, }); - }, 1000); + }, 600); }); } @@ -92,6 +92,7 @@ class Analysis extends Component { type: 'chart/clear', }); cancelAnimationFrame(this.reqRef); + clearTimeout(this.timeoutId); } handleChangeSalesType = e => { diff --git a/src/pages/Dashboard/Monitor.js b/src/pages/Dashboard/Monitor.js index fbbdb7bb..71fc6384 100644 --- a/src/pages/Dashboard/Monitor.js +++ b/src/pages/Dashboard/Monitor.js @@ -18,7 +18,7 @@ const targetTime = new Date().getTime() + 3900000; // use permission as a parameter const havePermissionAsync = new Promise(resolve => { // Call resolve on behalf of passed - setTimeout(() => resolve(), 100); + setTimeout(() => resolve(), 300); }); @Secured(havePermissionAsync) @connect(({ monitor, loading }) => ({ -- GitLab