From 8f629b1ef9849571685050425bfb01f37598e84a Mon Sep 17 00:00:00 2001 From: David Ralph Date: Tue, 27 Apr 2021 21:51:22 +0100 Subject: [PATCH] fix: background hot reload now only reloads when needed --- .../modals/main/settings/sections/Advanced.jsx | 2 +- src/components/widgets/background/Background.jsx | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/modals/main/settings/sections/Advanced.jsx b/src/components/modals/main/settings/sections/Advanced.jsx index 0d7d4642..451ba494 100644 --- a/src/components/modals/main/settings/sections/Advanced.jsx +++ b/src/components/modals/main/settings/sections/Advanced.jsx @@ -36,7 +36,7 @@ export default class AdvancedSettings extends React.PureComponent { return ( <>

{advanced.title}

- +

{advanced.data}

diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index ef7e19f1..39951e6a 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -87,7 +87,7 @@ export default class Background extends React.PureComponent { } // preloader for background transition - let preloader = document.createElement('img'); + const preloader = document.createElement('img'); preloader.src = url; // once image has loaded, add the fade-in transition @@ -269,12 +269,10 @@ export default class Background extends React.PureComponent { const backgroundType = localStorage.getItem('backgroundType'); - // todo: make this good - if (backgroundType !== this.state.type - || (localStorage.getItem('backgroundAPI') !== this.state.currentAPI && backgroundType === 'api') - || (backgroundType === 'custom' && localStorage.getItem('customBackground') !== this.state.url) - ) { - return refresh(); + if (this.state.photoInfo.offline !== true) { + if (backgroundType !== this.state.type || localStorage.getItem('backgroundAPI') !== this.state.currentAPI || (this.state.type === 'custom' && localStorage.getItem('customBackground') !== this.state.url)) { + return refresh(); + } } if (this.state.video === true) {