chore: cleanup
This commit is contained in:
parent
9c8d55af21
commit
38b035966b
2 changed files with 29 additions and 25 deletions
|
|
@ -43,14 +43,15 @@ registerPlugin<{ storage: Storage }>(
|
|||
if (api_.plugin.flags & PluginFlags.EnabledLate)
|
||||
refreshSettingsOverviewScreen()
|
||||
|
||||
api_.cleanup(refreshSettingsOverviewScreen)
|
||||
|
||||
Promise.all([import('./react-devtools'), api.storage.get()]).then(
|
||||
([rdt, settings]) => {
|
||||
if (settings.devtools.autoConnect) rdt.connect()
|
||||
},
|
||||
)
|
||||
},
|
||||
stop() {
|
||||
refreshSettingsOverviewScreen()
|
||||
},
|
||||
},
|
||||
PluginFlags.Enabled,
|
||||
InternalPluginFlags.Internal,
|
||||
|
|
|
|||
|
|
@ -16,31 +16,34 @@ registerPlugin(
|
|||
},
|
||||
{
|
||||
start({ cleanup }) {
|
||||
const unsubEB = waitForModules(byName('ErrorBoundary'), exports => {
|
||||
unsubEB()
|
||||
const unsubEB = waitForModules(
|
||||
byName<typeof DiscordErrorBoundary>('ErrorBoundary'),
|
||||
exports => {
|
||||
unsubEB()
|
||||
|
||||
instead(
|
||||
(exports as typeof DiscordErrorBoundary).prototype,
|
||||
'render',
|
||||
function (this: DiscordErrorBoundary) {
|
||||
if (this.state.error)
|
||||
return (
|
||||
<ErrorBoundaryScreen
|
||||
error={this.state.error}
|
||||
reload={this.handleReload.bind(this)}
|
||||
rerender={() => {
|
||||
this.setState({
|
||||
error: null,
|
||||
info: null,
|
||||
})
|
||||
}}
|
||||
/>
|
||||
)
|
||||
instead(
|
||||
exports.prototype,
|
||||
'render',
|
||||
function (this: DiscordErrorBoundary) {
|
||||
if (this.state.error)
|
||||
return (
|
||||
<ErrorBoundaryScreen
|
||||
error={this.state.error}
|
||||
reload={this.handleReload.bind(this)}
|
||||
rerender={() => {
|
||||
this.setState({
|
||||
error: null,
|
||||
info: null,
|
||||
})
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
return this.props.children
|
||||
},
|
||||
)
|
||||
})
|
||||
return this.props.children
|
||||
},
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
cleanup(unsubEB)
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue