Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

fix(#768): reset ErrorBoundary retryCount only after a retry settles

KaifAhmad1530e297d17dc
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8047c022..5e4ad863 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
+- **No React error boundaries around lazy-loaded Explorer workspaces — a single render error crashed the whole app** (#768, #794) by @Sameer6305
+ - Added an `ErrorBoundary` class component (`explorer/src/ErrorBoundary.tsx`) and wrapped each lazy-loaded workspace's `<Suspense>` block in `App.tsx` with it, keyed on the active sub-view so navigating away from and back to a crashed tab remounts it cleanly
+ - Failed retries are capped at 3 before the fallback UI switches from "Try Again" to a "Reload Application" dead-end, preventing infinite retry loops on deterministic crashes; raw error/stack details are logged via `console.error` only and never rendered into the fallback UI
+ - Fixed the retry counter so it resets after a retry actually succeeds and stays error-free for a few seconds, instead of never resetting (which could permanently exhaust the retry budget on unrelated, individually-recoverable transient errors) or resetting on the very next commit (which could fire prematurely while `Suspense` was still showing its fallback)
+
- **`tests/explorer/test_explorer_api.py` failed with `TypeError: Client.__init__() got an unexpected keyword argument 'app'` on current httpx** (#788, #789) by @Sameer6305
- `httpx>=0.28.0` removed the `app=` kwarg that Starlette's `TestClient` relies on to wrap a FastAPI app for testing; `httpx` wasn't pinned anywhere in `pyproject.toml`, so different environments could independently resolve an incompatible transitive version and hit the same break
- Added an explicit `httpx<0.28.0` constraint to the main `[project.dependencies]` array (not just a dev extra), so it applies globally across production, dev, and CI installs
diff --git a/explorer/src/ErrorBoundary.tsx b/explorer/src/ErrorBoundary.tsx
index 94fdb876..3d06af25 100644
--- a/explorer/src/ErrorBoundary.tsx
+++ b/explorer/src/ErrorBoundary.tsx
@@ -11,7 +11,11 @@ interface ErrorBoundaryState {
retryCount: number;
}
+const RETRY_SETTLE_MS = 5000;
+
export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
+ private settleTimer: ReturnType<typeof setTimeout> | null = null;
+
constructor(props: ErrorBoundaryProps) {
super(props);
this.state = { hasError: false, error: null, retryCount: 0 };
@@ -23,16 +27,35 @@ export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundarySt
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
console.error("ErrorBoundary caught an error:", error, errorInfo);
+ this.clearSettleTimer();
}
+ componentWillUnmount() {
+ this.clearSettleTimer();
+ }
+ private clearSettleTimer() {
+ if (this.settleTimer !== null) {
+ clearTimeout(this.settleTimer);
+ this.settleTimer = null;
+ }
+ }
resetErrorBoundary = () => {
- this.setState((prev) => ({
- hasError: false,
+ this.clearSettleTimer();
+ this.setState((prev) => ({
+ hasError: false,
error: null,
retryCount: prev.retryCount + 1
}));
+ // Only clear the retry count once the workspace has stayed error-free for a
+ // sustained period, rather than on the next committed render (which can fire
+ // while Suspense is still showing its fallback) or immediately on retry
+ // (which would allow an unbounded number of clicks on a deterministic crash).
+ this.settleTimer = setTimeout(() => {
+ this.settleTimer = null;
+ this.setState({ retryCount: 0 });
+ }, RETRY_SETTLE_MS);
};
render() {