Skip to content

v1.3.0 - Fix Auth Session Corruption in Multi-tab Sessions

Choose a tag to compare

@batsonjay batsonjay released this 06 Jun 19:25
· 19 commits to main since this release

Fixed

Multi-tab token refresh coordination (@relaya-chat/react)

When several browser tabs are open simultaneously, each tab previously ran its own refresh timer — causing two tabs to call /auth/refresh with the same token at once. One tab would invalidate the other's newly rotated tokens, triggering spurious re-authentication. A localStorage lease now elects a single leader tab to perform each refresh; a BroadcastChannel propagates the new tokens to all other tabs. Falls back to race-aware refresh where BroadcastChannel is unavailable.

Race-aware token refresh (@relaya-chat/react)

clearStoredRefreshTokenIfCurrent() prevents a "losing" tab from wiping a "winning" tab's freshly rotated refresh token. On a 401, the SDK now re-reads localStorage before giving up — if another tab has already succeeded, it retries with the new token rather than ending the session. Authenticated WebSocket connections now call ensureFreshToken() before the upgrade, preventing a stuck reconnect loop caused by sending an expired access token on the initial WS handshake.

Scroll-to-bottom reliability (@relaya-chat/react)

Removed scroll-behavior: smooth from the message list container and the isProgrammaticScrollRef / 500 ms suppression workaround. The initial jump to the bottom is now instant; smooth scrolling is preserved for new messages arriving while the view is already at the bottom. Resolves the ↓ button vanishing in active chats.