fix: background hot reload now only reloads when needed

This commit is contained in:
David Ralph
2021-04-27 21:51:22 +01:00
parent 79a0ec8df9
commit 8f629b1ef9
2 changed files with 6 additions and 8 deletions

View File

@@ -36,7 +36,7 @@ export default class AdvancedSettings extends React.PureComponent {
return (
<>
<h2>{advanced.title}</h2>
<Checkbox name='offlineMode' text={advanced.offline_mode} />
<Checkbox name='offlineMode' text={advanced.offline_mode} element='.other' />
<h3>{advanced.data}</h3>
<button className='reset' onClick={() => this.setState({ resetModal: true })}>{this.language.buttons.reset}</button>

View File

@@ -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) {