diff options
| author | AAGaming <aagaming@riseup.net> | 2024-07-09 02:35:24 -0400 |
|---|---|---|
| committer | AAGaming <aagaming@riseup.net> | 2024-08-03 14:04:19 -0400 |
| commit | 28c7254ef6952d9504472ebcbb05238b50aa6086 (patch) | |
| tree | 2c9dd8359ad06a2b4cbb38763fe7ae845b4489e0 /frontend/src/errorboundary-hook.tsx | |
| parent | dcfaf11696edbed2a9c0be01a7c37e8faab773bc (diff) | |
| download | decky-loader-28c7254ef6952d9504472ebcbb05238b50aa6086.tar.gz decky-loader-28c7254ef6952d9504472ebcbb05238b50aa6086.zip | |
initial implementation of new router and qam hooks
Diffstat (limited to 'frontend/src/errorboundary-hook.tsx')
| -rw-r--r-- | frontend/src/errorboundary-hook.tsx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/frontend/src/errorboundary-hook.tsx b/frontend/src/errorboundary-hook.tsx index 8c96d9f4..072c96ca 100644 --- a/frontend/src/errorboundary-hook.tsx +++ b/frontend/src/errorboundary-hook.tsx @@ -22,9 +22,7 @@ class ErrorBoundaryHook extends Logger { this.log('Initialized'); window.__ERRORBOUNDARY_HOOK_INSTANCE?.deinit?.(); window.__ERRORBOUNDARY_HOOK_INSTANCE = this; - } - init() { // valve writes only the sanest of code const exp = /^\(\)=>\(.\|\|.\(new .\),.\)$/; const initErrorReportingStore = findModuleExport( @@ -76,6 +74,11 @@ class ErrorBoundaryHook extends Logger { } this.errorBoundaryPatch = replacePatch(ErrorBoundary.prototype, 'render', function (this: any) { + if (this.state._deckyForceRerender) { + const stateClone = {...this.state, _deckyForceRerender: null}; + this.setState(stateClone); + return null; + } if (this.state.error) { const store = Object.getPrototypeOf(this)?.constructor?.sm_ErrorReportingStore || errorReportingStore; return ( @@ -89,6 +92,10 @@ class ErrorBoundaryHook extends Logger { } return callOriginal; }); + // Small hack that gives us a lot more flexibility to force rerenders. + ValveErrorBoundary.prototype._deckyForceRerender = function (this: any) { + this.setState({...this.state, _deckyForceRerender: true}); + } } public temporarilyDisableReporting() { |
