CR v0.1.2

This commit is contained in:
_Lighty_ 2020-01-12 18:38:14 +01:00
parent 0f732730a4
commit 5649d7d6ac
2 changed files with 12 additions and 7 deletions

View File

@ -1,4 +1,8 @@
# [CrashRecovery](https://1lighty.github.io/BetterDiscordStuff/?plugin=CrashRecovery "CrashRecovery") Changelog # [CrashRecovery](https://1lighty.github.io/BetterDiscordStuff/?plugin=CrashRecovery "CrashRecovery") Changelog
### 0.1.2
- Fixed crash screen being blank if a plugin failed to stop properly.
- Now closes all modals, including the special types that are not stored inside ModalStack.
### 0.1.1 ### 0.1.1
- Fixed failing to recover from a crash if a plugin is preventing it. - Fixed failing to recover from a crash if a plugin is preventing it.

View File

@ -41,7 +41,7 @@ var CrashRecovery = (() => {
twitter_username: '' twitter_username: ''
} }
], ],
version: '0.1.1', version: '0.1.2',
description: 'THIS IS AN EXPERIMENTAL PLUGIN! In the event that your Discord crashes, the plugin enables you to get Discord back to a working state, without needing to reload at all.', description: 'THIS IS AN EXPERIMENTAL PLUGIN! In the event that your Discord crashes, the plugin enables you to get Discord back to a working state, without needing to reload at all.',
github: 'https://github.com/1Lighty', github: 'https://github.com/1Lighty',
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/CrashRecovery/CrashRecovery.plugin.js' github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/CrashRecovery/CrashRecovery.plugin.js'
@ -50,7 +50,7 @@ var CrashRecovery = (() => {
{ {
title: 'fixed', title: 'fixed',
type: 'fixed', type: 'fixed',
items: ['Fixed failing to recover from a crash if a plugin is preventing it.'] items: ['Fixed crash screen being blank if a plugin failed to stop properly.', 'Now closes all modals, including the special types that are not stored inside ModalStack.']
} }
] ]
}; };
@ -151,11 +151,17 @@ var CrashRecovery = (() => {
DiscordModules.LayerManager.popAllLayers(); DiscordModules.LayerManager.popAllLayers();
DiscordModules.PopoutStack.closeAll(); DiscordModules.PopoutStack.closeAll();
DiscordModules.NavigationUtils.transitionTo('/channels/@me'); DiscordModules.NavigationUtils.transitionTo('/channels/@me');
WebpackModules.getByProps('openModal').modalsApi.setState(() => ({ default: [] })); /* slow? unsafe? async? */
}); });
} }
handleCrash(_this, stack, isRender) { handleCrash(_this, stack, isRender) {
this.onCrashRecoveredDelayedCall.cancel(); this.onCrashRecoveredDelayedCall.cancel();
if (!isRender) {
_this.setState({
error: { stack }
});
}
if (!this.notificationId) { if (!this.notificationId) {
this.notificationId = XenoLib.Notifications.danger('Crash detected, attempting recovery', { timeout: 0, loading: true }); this.notificationId = XenoLib.Notifications.danger('Crash detected, attempting recovery', { timeout: 0, loading: true });
} }
@ -178,11 +184,6 @@ var CrashRecovery = (() => {
global.bdpluginErrors = []; global.bdpluginErrors = [];
}, 750); }, 750);
} }
if (!isRender) {
_this.setState({
error: { stack }
});
}
if (this.setStateTimeout) return; if (this.setStateTimeout) return;
if (this.attempts >= 10 || (this.attempts >= 2 && (!responsiblePlugins || !responsiblePlugins[0]))) { if (this.attempts >= 10 || (this.attempts >= 2 && (!responsiblePlugins || !responsiblePlugins[0]))) {
XenoLib.Notifications.update(this.notificationId, { content: 'Failed to recover from crash', loading: false }); XenoLib.Notifications.update(this.notificationId, { content: 'Failed to recover from crash', loading: false });