From 515748a6ca2cea2a7d99be21658a557c76c7e2bf Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Sat, 15 Feb 2020 20:22:33 -0800 Subject: [PATCH] htmlui: prevent flicker when refreshing snapshot sources --- htmlui/src/SourcesTable.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htmlui/src/SourcesTable.js b/htmlui/src/SourcesTable.js index 0f827a009..666011305 100644 --- a/htmlui/src/SourcesTable.js +++ b/htmlui/src/SourcesTable.js @@ -22,20 +22,20 @@ export class SourcesTable extends Component { }; this.sync = this.sync.bind(this); - this.fetchSources = this.fetchSources.bind(this); + this.fetchSourcesWithoutSpinner = this.fetchSourcesWithoutSpinner.bind(this); } componentDidMount() { - this.fetchSources(); - this.interval = window.setInterval(this.fetchSources, 5000); + this.setState({ isLoading: true }); + this.fetchSourcesWithoutSpinner(); + this.interval = window.setInterval(this.fetchSourcesWithoutSpinner, 5000); } componentWillUnmount() { window.clearInterval(this.interval); } - fetchSources() { - this.setState({ isLoading: true }); + fetchSourcesWithoutSpinner() { axios.get('/api/v1/sources').then(result => { this.setState({ sources: result.data.sources, @@ -56,7 +56,7 @@ export class SourcesTable extends Component { sync() { this.setState({ isLoading: true }); axios.post('/api/v1/repo/sync', {}).then(result => { - this.fetchSources(); + this.fetchSourcesWithoutSpinner(); }).catch(error => { alert('failed'); this.setState({