diff --git a/Docs/Architekture.md b/Docs/Architekture.md index d69f24a..bc8d4dd 100644 --- a/Docs/Architekture.md +++ b/Docs/Architekture.md @@ -1616,6 +1616,7 @@ BanGUI implements **distributed tracing** via **correlation IDs** to correlate e - Error boundaries: `frontend/src/components/{Error,Page,Section}ErrorBoundary.tsx` - Catch render-time exceptions - Log with telemetry for observability + - **Note:** `ErrorBoundary.componentDidCatch()` accesses `errorInfo.componentStack` which is not part of the public React.ErrorInfo type definition. This is a React DevTools implementation detail accessed via type casting (`as any`). It captures the React component hierarchy for debugging but may change in future React versions. See [React issue #3623](https://github.com/facebook/react/issues/3623) for context. ### Privacy & Security diff --git a/Docs/Tasks.md b/Docs/Tasks.md index 6ae4df0..0235c86 100644 --- a/Docs/Tasks.md +++ b/Docs/Tasks.md @@ -1,41 +1,3 @@ -## [Frontend] usePolledData — setInterval without drift correction - -**Where found** - -- `frontend/src/hooks/usePolledData.ts` — uses `setInterval` without tracking expected next poll time - -**Why this is needed** - -With fixed `setInterval`, if `refetch` takes time (e.g., 2 seconds for slow API) and `pollInterval` is 5 seconds, the actual polling pattern accumulates drift. Effective polling interval becomes > 5 seconds, wasting bandwidth and CPU. - -**Goal** - -Implement drift-corrected polling that schedules next poll relative to **completion** of previous poll, not its start. - -**What to do** - -1. Replace `setInterval` with self-scheduling timeout -2. Track elapsed time between poll start and completion -3. Schedule next poll with compensation: `delay = Math.max(0, pollInterval - elapsed)` -4. Alternatively use `use-sse` or custom hook `useDriftCorrectedPolling` - -**Possible traps and issues** - -- Cancellation check must happen both before and after `await refetch()` to prevent race conditions -- Coordinate cancellation with `AbortController` already used by `useFetchData` -- If `pollInterval` changes, hook must restart polling loop - -**Docs changes needed** - -- Update `frontend/src/hooks/README.md` — document drift-corrected polling behavior - -**Doc references** - -- `frontend/src/hooks/usePolledData.ts` -- `frontend/src/hooks/README.md` - ---- - ## [Frontend] ErrorBoundary — non-standard `componentStack` property **Where found** diff --git a/frontend/src/components/ErrorBoundary.tsx b/frontend/src/components/ErrorBoundary.tsx index f4c58c2..887b681 100644 --- a/frontend/src/components/ErrorBoundary.tsx +++ b/frontend/src/components/ErrorBoundary.tsx @@ -107,9 +107,18 @@ export class ErrorBoundary extends React.Component