[PR #6932] [MERGED] fix(client): set session data on refreshManager #15220

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6932
Author: @himself65
Created: 12/22/2025
Status: Merged
Merged: 12/23/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/12/22/flip


📝 Commits (7)

  • 5856353 fix(client): isPending when data is stale
  • dbdaaa4 Apply suggestions from code review
  • 245e691 fix: client
  • f42325b Revert "Apply suggestions from code review"
  • 918437f Revert "fix(client): isPending when data is stale"
  • 20feea3 Merge branch 'canary' into himself65/2025/12/22/flip
  • 46d2b6a fix: type

📊 Changes

4 files changed (+55 additions, -38 deletions)

View changed files

📝 packages/better-auth/src/client/query.ts (+11 -9)
📝 packages/better-auth/src/client/session-atom.ts (+7 -1)
📝 packages/better-auth/src/client/session-refresh.test.ts (+13 -20)
📝 packages/better-auth/src/client/session-refresh.ts (+24 -8)

📄 Description

Fixes: https://github.com/better-auth/better-auth/issues/6879


Summary by cubic

Fixes isPending in useAuthQuery when data is stale and updates the session refresh manager to set session data and errors on poll, keeping the UI in sync without flicker.

  • Bug Fixes
    • Set isPending when data is null/undefined or the previous state was pending.
    • On poll, write sessionAtom with /get-session result and clear data on error to keep session state consistent.

Written for commit 46d2b6a879. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6932 **Author:** [@himself65](https://github.com/himself65) **Created:** 12/22/2025 **Status:** ✅ Merged **Merged:** 12/23/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/12/22/flip` --- ### 📝 Commits (7) - [`5856353`](https://github.com/better-auth/better-auth/commit/5856353bad0e8c1b7537892a1a3393f49761dfe6) fix(client): `isPending` when data is stale - [`dbdaaa4`](https://github.com/better-auth/better-auth/commit/dbdaaa45f1ed5d58eb22696dab9432a12cf573e6) Apply suggestions from code review - [`245e691`](https://github.com/better-auth/better-auth/commit/245e691e04a503596901728cf7a49142b5034258) fix: client - [`f42325b`](https://github.com/better-auth/better-auth/commit/f42325b1d8fcdb22fdb4924265a83b9bc37a99ba) Revert "Apply suggestions from code review" - [`918437f`](https://github.com/better-auth/better-auth/commit/918437fab333a8b6783b8550e583a75c3bdf4331) Revert "fix(client): `isPending` when data is stale" - [`20feea3`](https://github.com/better-auth/better-auth/commit/20feea3abe19ac4147935c990f443d4d551e71f9) Merge branch 'canary' into himself65/2025/12/22/flip - [`46d2b6a`](https://github.com/better-auth/better-auth/commit/46d2b6a879d18d99ecf84a885f464b581f58c953) fix: type ### 📊 Changes **4 files changed** (+55 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/client/query.ts` (+11 -9) 📝 `packages/better-auth/src/client/session-atom.ts` (+7 -1) 📝 `packages/better-auth/src/client/session-refresh.test.ts` (+13 -20) 📝 `packages/better-auth/src/client/session-refresh.ts` (+24 -8) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/issues/6879 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes isPending in useAuthQuery when data is stale and updates the session refresh manager to set session data and errors on poll, keeping the UI in sync without flicker. - **Bug Fixes** - Set isPending when data is null/undefined or the previous state was pending. - On poll, write sessionAtom with /get-session result and clear data on error to keep session state consistent. <sup>Written for commit 46d2b6a879d18d99ecf84a885f464b581f58c953. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 09:53:48 -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#15220