Update documentation and ErrorBoundary component

- Updated architecture documentation with refactoring notes
- Updated task documentation with progress
- Enhanced ErrorBoundary component for better error handling

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-04-30 20:43:41 +02:00
parent 3bd2a71367
commit f074882f2d
3 changed files with 11 additions and 39 deletions

View File

@@ -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**