Skip to content

fix: add subscription manager to prevent GraphQL subscription leaks#265

Merged
lukepolo merged 1 commit intomainfrom
audit/385-subscription-manager
Apr 9, 2026
Merged

fix: add subscription manager to prevent GraphQL subscription leaks#265
lukepolo merged 1 commit intomainfrom
audit/385-subscription-manager

Conversation

@Flegma
Copy link
Copy Markdown
Contributor

@Flegma Flegma commented Apr 8, 2026

Summary

  • Create useSubscriptionManager composable for centralized subscription lifecycle management
  • Refactor NotificationStore (3 subscriptions), ApplicationSettings (3 subscriptions + setInterval guard), MatchmakingStore (3 subscriptions), MatchLobbyStore (8 subscriptions) to track and auto-cleanup subscriptions
  • Add cleanup on auth state change (when me becomes falsy)
  • Fix setInterval leak in ApplicationSettings where a new interval was created on every subscription emit

Closes 5stackgg/5stack-panel#385

Test plan

  • Verify subscriptions are created on login and cleaned up on logout
  • Verify re-authentication doesn't accumulate duplicate subscriptions
  • Verify latency check interval is created only once
  • Verify all store data updates correctly via subscriptions

Create useSubscriptionManager composable that tracks subscriptions by
key, auto-unsubscribes previous on same key. Refactor all stores to
use it: NotificationStore (3 subs), ApplicationSettings (3 subs +
setInterval guard), MatchmakingStore (3 subs), MatchLobbyStore (8
subs). Add cleanup on auth state change.
@lukepolo lukepolo merged commit a9ca1cd into main Apr 9, 2026
@lukepolo lukepolo deleted the audit/385-subscription-manager branch April 9, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Web] GraphQL subscription leaks — NotificationStore, ApplicationSettings, Matchmaking, MatchLobby

2 participants