ralph/collaboration-and-character-variables #9

Merged
GHMiranda merged 22 commits from ralph/collaboration-and-character-variables into developing 2026-01-25 00:11:21 +00:00
1 changed files with 15 additions and 0 deletions
Showing only changes of commit 3b19f58e26 - Show all commits

View File

@ -77,6 +77,21 @@ export class RealtimeConnection {
this.resetInactivityTimer()
this.clearConnectionTimer()
// Ensure the Supabase client has a valid auth session before connecting.
// On initial page load, the session may still be loading from cookies.
try {
const { data: { session } } = await this.supabase.auth.getSession()
if (!session && !this.isDestroyed) {
// No session yet - wait briefly and retry
this.scheduleReconnect()
return
}
} catch {
// Session check failed - proceed anyway, channel will handle auth errors
}
if (this.isDestroyed || this.isPaused) return
// Set a timeout: if we don't connect within CONNECTION_TIMEOUT_MS, retry
this.connectionTimer = setTimeout(() => {
if (this.isDestroyed || this.isPaused) return