From 19f08ee81ffa71519c40336ff94863bfcbdaf7f1 Mon Sep 17 00:00:00 2001 From: Simon Howe Date: Tue, 2 Aug 2016 22:09:08 +0200 Subject: [PATCH] Review feedback on loading-indicator --- client/app/scripts/components/loading.js | 1 - client/app/scripts/components/nodes.js | 2 +- client/app/scripts/utils/delayed-show.js | 20 +++++++++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/client/app/scripts/components/loading.js b/client/app/scripts/components/loading.js index afd21b940..2696f46b1 100644 --- a/client/app/scripts/components/loading.js +++ b/client/app/scripts/components/loading.js @@ -14,7 +14,6 @@ const LOADING_TEMPLATES = [ 'Locating THINGS', 'Optimizing THINGS', 'Transporting THINGS', - 'Double checking THINGS', ]; diff --git a/client/app/scripts/components/nodes.js b/client/app/scripts/components/nodes.js index 92db420dd..38ae981c2 100644 --- a/client/app/scripts/components/nodes.js +++ b/client/app/scripts/components/nodes.js @@ -73,7 +73,7 @@ class Nodes extends React.Component { return (
- + this.setState({ show: true }), this.props.delay); - } - - cancelShow() { - clearTimeout(this.showTimeout); + componentWillUnmount() { + this.cancelShow(); } componentWillReceiveProps(nextProps) { @@ -34,6 +32,14 @@ export class DelayedShow extends React.Component { } } + scheduleShow() { + this.showTimeout = setTimeout(() => this.setState({ show: true }), this.props.delay); + } + + cancelShow() { + clearTimeout(this.showTimeout); + } + render() { const { children } = this.props; const { show } = this.state;