From bf8ada27d76dd6835d0fbd77fb31a5c3d841e5e0 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 23 Jul 2018 18:18:29 -0400 Subject: [PATCH] remove the spinner if necessary after clearing the timeout --- src/renderer/component/page/view.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/renderer/component/page/view.jsx b/src/renderer/component/page/view.jsx index c8dbca313..34998d528 100644 --- a/src/renderer/component/page/view.jsx +++ b/src/renderer/component/page/view.jsx @@ -39,10 +39,16 @@ class Page extends React.PureComponent { componentDidUpdate(prevProps: Props) { const { loading } = this.props; + const { showLoader } = this.state; + if (!this.loaderTimeout && !prevProps.loading && loading) { this.beginLoadingTimeout(); } else if (!loading && this.loaderTimeout) { clearTimeout(this.loaderTimeout); + + if (showLoader) { + this.removeLoader(); + } } } @@ -58,6 +64,10 @@ class Page extends React.PureComponent { }, LOADER_TIMEOUT); } + removeLoader() { + this.setState({ showLoader: false }); + } + loaderTimeout: ?TimeoutID; render() {