feat(web-ui): pause dashboard polling, sockets, and chart updates when the tab is hidden
This commit is contained in:
@@ -111,7 +111,7 @@ ts_web/
|
||||
|
||||
### State Management
|
||||
|
||||
The app uses `@push.rocks/smartstate` with multiple state parts:
|
||||
The app uses `@push.rocks/smartstate` v2.3+ with multiple state parts, scheduled actions with `autoPause: 'visibility'`, and batched updates:
|
||||
|
||||
| State Part | Mode | Description |
|
||||
|-----------|------|-------------|
|
||||
@@ -125,6 +125,16 @@ The app uses `@push.rocks/smartstate` with multiple state parts:
|
||||
| `certificateStatePart` | Soft | Certificate list, summary, loading state |
|
||||
| `remoteIngressStatePart` | Soft | Edge list, statuses, new edge secret |
|
||||
|
||||
### Tab Visibility Optimization
|
||||
|
||||
The dashboard automatically pauses all background activity when the browser tab is hidden and resumes when visible:
|
||||
|
||||
- **Auto-refresh polling** uses `createScheduledAction` with `autoPause: 'visibility'` — stops HTTP requests while the tab is sleeping
|
||||
- **In-flight guard** prevents concurrent refresh requests from piling up
|
||||
- **WebSocket connection** disconnects when hidden and reconnects when visible, preventing log entry accumulation
|
||||
- **Network traffic timer** pauses chart updates when the tab is backgrounded
|
||||
- **Log entry batching** — incoming WebSocket log pushes are buffered and flushed once per animation frame to avoid per-entry re-renders
|
||||
|
||||
### Actions
|
||||
|
||||
```typescript
|
||||
|
||||
Reference in New Issue
Block a user