Skip to content

fix: add null guard for liveServer in Live Components compat layer#97

Merged
MarcosBrendonDePaula merged 2 commits intomainfrom
claude/resolve-open-issue-3M0cU
Mar 14, 2026
Merged

fix: add null guard for liveServer in Live Components compat layer#97
MarcosBrendonDePaula merged 2 commits intomainfrom
claude/resolve-open-issue-3M0cU

Conversation

@MarcosBrendonDePaula
Copy link
Copy Markdown
Collaborator

Summary

  • Replace all unsafe liveServer! non-null assertions with a requireLiveServer() helper that throws a clear error message when the LiveComponents plugin hasn't been initialized yet
  • Affects all deprecated compat singletons: componentRegistry, connectionManager, liveRoomManager, roomEvents, fileUploadManager, performanceMonitor, stateSignature, roomState, and liveAuthManager getters
  • Before: accessing any singleton before plugin setup caused an opaque crash on null dereference
  • After: throws Error('LiveComponents plugin not initialized. Ensure the live-components plugin is loaded before accessing Live singletons.')

Closes #85

Test plan

  • Verify accessing a compat singleton before plugin init throws the descriptive error
  • Verify normal usage after plugin init works as before
  • Run existing test suite to confirm no regressions

https://claude.ai/code/session_01SSpighMyBxnrVh35Ke2Szm

claude added 2 commits March 14, 2026 14:36
Replace unsafe non-null assertions (liveServer!) with a requireLiveServer()
helper that throws a descriptive error when the LiveComponents plugin has
not been initialized yet. This prevents opaque runtime crashes when compat
singletons are accessed before plugin setup.

Closes #85

https://claude.ai/code/session_01SSpighMyBxnrVh35Ke2Szm
12 tests covering:
- All 8 Proxy singletons throw descriptive error when liveServer is null
- liveAuthManager getters throw descriptive error when uninitialized
- liveAuthManager.register() buffers providers when liveServer is null
- Proxy delegates correctly when liveServer is initialized
- liveAuthManager.register() delegates to liveServer.useAuth when initialized

https://claude.ai/code/session_01SSpighMyBxnrVh35Ke2Szm
@MarcosBrendonDePaula MarcosBrendonDePaula merged commit 3017b8c into main Mar 14, 2026
11 checks passed
@MarcosBrendonDePaula MarcosBrendonDePaula deleted the claude/resolve-open-issue-3M0cU branch March 14, 2026 16:23
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.

Corrigir Proxy sobre null em Live Components compat layer

2 participants