From 054517595d7e50f3354d3eeeea8da1567e0b0dfc Mon Sep 17 00:00:00 2001
From: AAGaming <aagaming@riseup.net>
Date: Fri, 3 Jan 2025 22:53:37 -0500
Subject: fix(ErrorBoundary): use same conditions as Valve boundary for
 rendering this fixes the screenshot deletion error

---
 frontend/src/errorboundary-hook.tsx | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

(limited to 'frontend/src/errorboundary-hook.tsx')

diff --git a/frontend/src/errorboundary-hook.tsx b/frontend/src/errorboundary-hook.tsx
index 95be77ab..2c69a267 100644
--- a/frontend/src/errorboundary-hook.tsx
+++ b/frontend/src/errorboundary-hook.tsx
@@ -79,9 +79,17 @@ class ErrorBoundaryHook extends Logger {
         this.setState(stateClone);
         return null;
       }
-      if (this.state.error) {
+      // yoinked from valve error boundary
+      if (this.state.error && this.props.errorKey == this.state.lastErrorKey) {
         const store = Object.getPrototypeOf(this)?.constructor?.sm_ErrorReportingStore || errorReportingStore;
-        return (
+
+        return void 0 !== this.props.fallback ? (
+          'function' == typeof this.props.fallback ? (
+            this.props.fallback(this.state.error.error)
+          ) : (
+            this.props.fallback
+          )
+        ) : (
           <DeckyErrorBoundary
             error={this.state.error}
             errorKey={this.props.errorKey}
-- 
cgit v1.2.3

