Skip to content

Fix idle-resume visibility listener churn#2399

Merged
ejsmith merged 2 commits into
mainfrom
issue/idle-resume-lockup
Jul 25, 2026
Merged

Fix idle-resume visibility listener churn#2399
ejsmith merged 2 commits into
mainfrom
issue/idle-resume-lockup

Conversation

@ejsmith

@ejsmith ejsmith commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary

  • register document visibility tracking once for each DocumentVisibility lifecycle instead of creating child effects from the visible getter
  • keep visibility state reactive for the WebSocket and Intercom consumers
  • add an Intercom regression test covering repeated hidden/resume cycles and token refreshes

Root cause

Reading DocumentVisibility.visible from reactive effects dynamically created another child effect and event listener. When visibility or Intercom boot options changed, those child effects were torn down and recreated. The regression test reproduced 502 visibilitychange registrations across 100 hidden/resume cycles; the updated implementation keeps one registration. This listener/effect churn could eventually trip Svelte's effect_update_depth_exceeded guard and leave the page unresponsive after resuming an idle tab.

Validation

  • npm run validate
  • npm run test:unit -- --run — 299 tests passed
  • focused Intercom/WebSocket tests — 31 tests passed
  • npm run build
  • local frontend and proxied API health checks returned HTTP 200

Breaking changes

None.

@ejsmith

ejsmith commented Jul 25, 2026

Copy link
Copy Markdown
Member Author

/preview

@github-actions github-actions Bot added the dev-preview Deploy this pull request to the shared dev environment. label Jul 25, 2026
@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown

Preview deployed

@ejsmith
ejsmith marked this pull request as ready for review July 25, 2026 21:49
@ejsmith
ejsmith merged commit d64ff31 into main Jul 25, 2026
8 checks passed
@ejsmith
ejsmith deleted the issue/idle-resume-lockup branch July 25, 2026 21:56
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Complexity Health
Exceptionless.Core 73% 65% 9499
Exceptionless.AppHost 38% 40% 139
Exceptionless.Insulation 23% 23% 205
Exceptionless.Web 84% 67% 6933
Summary 76% (22519 / 29459) 65% (10344 / 15858) 16776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev-preview Deploy this pull request to the shared dev environment.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant