[PR #5691] refactor(client): revalidate logic #14409

Closed
opened 2026-04-13 09:27:37 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5691

State: closed
Merged: Yes


Summary by cubic

Refactored session revalidation to use centralized FocusManager, OnlineManager, and a global BroadcastChannel for consistent refresh across web and Expo/React Native. Replaced direct event listeners with manager-based focus/online detection and a single storage channel.

  • Refactors
    • Added FocusManager and OnlineManager to trigger refetch on focus/visibility and when coming back online.
    • Rewrote session-refresh to use and initialize these managers, replacing direct event listeners.
    • Centralized BroadcastChannel with a global instance and setup; session-refresh now subscribes to it.
    • Simplified session-atom mount logic; managers handle no-op in non-browser contexts.
    • Exported FocusManager and OnlineManager types and symbols from the client entry.
    • Added Expo implementations; expo client auto-sets them up on native, uses expo-network when available, and re-exports.

Written for commit ed6dde1dc7. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5691 **State:** closed **Merged:** Yes --- <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Refactored session revalidation to use centralized FocusManager, OnlineManager, and a global BroadcastChannel for consistent refresh across web and Expo/React Native. Replaced direct event listeners with manager-based focus/online detection and a single storage channel. - **Refactors** - Added FocusManager and OnlineManager to trigger refetch on focus/visibility and when coming back online. - Rewrote session-refresh to use and initialize these managers, replacing direct event listeners. - Centralized BroadcastChannel with a global instance and setup; session-refresh now subscribes to it. - Simplified session-atom mount logic; managers handle no-op in non-browser contexts. - Exported FocusManager and OnlineManager types and symbols from the client entry. - Added Expo implementations; expo client auto-sets them up on native, uses expo-network when available, and re-exports. <sup>Written for commit ed6dde1dc70b8d485e866b7fb4ce0d3d8bc4f1be. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:27:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#14409