perf: gate ConnectionStatusIndicator /admin/health poll on Page Visibility #54

Open
opened 2026-05-31 16:08:32 +00:00 by zaelgohary · 0 comments
Member

crates/hero_biz_app/src/components/connection_status.rs polls /hero_biz/admin/health + backend_url every 10s in a never-pausing use_future loop. When hero_biz_app runs in a hidden iframe (parent display:none), the poll continues and burns RPCs.

Repro

Observed during hero_os boot-path investigation: /hero_biz/admin/health requests fired continuously in the Network tab even when no hero_biz island was mounted in the visible viewport.

Fix sketch

Gate the polling loop on document.visibilityState == "visible". When hidden, skip the tick; resume on visibilitychange. Same pattern as Page Visibility API; reflects parent display:none for iframes.

Not blocking; tracking for cleanup.

`crates/hero_biz_app/src/components/connection_status.rs` polls `/hero_biz/admin/health` + backend_url every 10s in a never-pausing `use_future` loop. When hero_biz_app runs in a hidden iframe (parent display:none), the poll continues and burns RPCs. ## Repro Observed during hero_os boot-path investigation: `/hero_biz/admin/health` requests fired continuously in the Network tab even when no hero_biz island was mounted in the visible viewport. ## Fix sketch Gate the polling loop on `document.visibilityState == "visible"`. When hidden, skip the tick; resume on `visibilitychange`. Same pattern as Page Visibility API; reflects parent display:none for iframes. Not blocking; tracking for cleanup.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_biz#54
No description provided.