From c28974f019aab9ed39fe84cfa94d8d4daec99e58 Mon Sep 17 00:00:00 2001 From: Jernej Pregelj Date: Tue, 6 Aug 2019 11:42:58 +0200 Subject: [PATCH] add loading to category and license --- client/src/routes/Search/index.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/client/src/routes/Search/index.tsx b/client/src/routes/Search/index.tsx index a3f9e3b..565581b 100644 --- a/client/src/routes/Search/index.tsx +++ b/client/src/routes/Search/index.tsx @@ -139,12 +139,11 @@ class Search extends PureComponent { } private pendingSearch = () => { - this.setState({isLoading:true},()=>{ - if(this.timeout){ - clearTimeout(this.timeout) - } - this.timeout = setTimeout(this.executeSearch,250); - }) + this.setState({isLoading:true}) + if(this.timeout){ + clearTimeout(this.timeout) + } + this.timeout = setTimeout(this.executeSearch,500); } private executeSearch=()=>{ @@ -153,11 +152,11 @@ class Search extends PureComponent { } public setCategory = (category: string) => { - this.setState({ category }, () => this.searchAssets()) + this.setState({ category, isLoading: true }, () => this.searchAssets()) } public setLicense = (license: string) => { - this.setState({ license }, () => this.searchAssets()) + this.setState({ license, isLoading: true }, () => this.searchAssets()) } public renderResults = () =>