Skip to content

Commit

Permalink
fix(App): Don't reload app when coming back from system sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
adlk committed Apr 6, 2022
1 parent 6c02f29 commit bc6a921
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/stores/AppStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,16 @@ export default class AppStore extends Store {
if (this.timeSuspensionStart.add(10, 'm').isBefore(moment())) {
debug('Reloading services, user info and features');
setInterval(() => {
debug('Reload app interval is starting');
const reloadInterval = setInterval(() => {
debug('Reload app interval is starting, checking for internet connection');
if (this.isOnline) {
window.location.reload();
debug('Clearing interval, invalidating stores');
clearInterval(reloadInterval);
this.stores.user.getUserInfoRequest.invalidate({ immediately: true });
this.stores.services.allServicesRequest.invalidate({ immediately: true });
this.stores.features.defaultFeaturesRequest.invalidate({ immediately: true });
this.stores.features.featuresRequest.invalidate({ immediately: true });
}
}, ms('2s'));
}
Expand Down

0 comments on commit bc6a921

Please sign in to comment.