[PR #5763] [MERGED] fix: additional fields default values should apply when creating session #6209

Closed
opened 2026-03-13 12:51:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5763
Author: @Bekacru
Created: 11/5/2025
Status: Merged
Merged: 11/30/2025
Merged by: @Bekacru

Base: canaryHead: fix/additional-fields


📝 Commits (1)

  • 726a5b9 fix: additional fields should apply for session model

📊 Changes

2 files changed (+92 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/db/internal-adapter.ts (+11 -1)
📝 packages/better-auth/src/plugins/additional-fields/additional-fields.test.ts (+81 -0)

📄 Description

closes #5687


Summary by cubic

Fixes #5687 by applying default values for session additionalFields during session creation. Ensures defaults are saved and returned by getSession, including with secondary storage.

  • Bug Fixes
    • Use parseSessionInput to merge default additionalFields into new sessions.
    • Add tests verifying defaults with database hooks and with secondary storage.

Written for commit 726a5b90b5. 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/5763 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 11/5/2025 **Status:** ✅ Merged **Merged:** 11/30/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/additional-fields` --- ### 📝 Commits (1) - [`726a5b9`](https://github.com/better-auth/better-auth/commit/726a5b90b5c41bcddfdf8d9465a8f7e36fab2d85) fix: additional fields should apply for session model ### 📊 Changes **2 files changed** (+92 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/internal-adapter.ts` (+11 -1) 📝 `packages/better-auth/src/plugins/additional-fields/additional-fields.test.ts` (+81 -0) </details> ### 📄 Description closes #5687 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes #5687 by applying default values for session additionalFields during session creation. Ensures defaults are saved and returned by getSession, including with secondary storage. - **Bug Fixes** - Use parseSessionInput to merge default additionalFields into new sessions. - Add tests verifying defaults with database hooks and with secondary storage. <sup>Written for commit 726a5b90b5c41bcddfdf8d9465a8f7e36fab2d85. 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-03-13 12:51:08 -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#6209