[PR #5852] [MERGED] fix: update hooks return should merge with original data #23178

Closed
opened 2026-04-15 21:32:02 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

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

Base: canaryHead: fix/hooks


📝 Commits (2)

  • eaba532 fix: update hooks return should merge with origial data
  • 78880a7 restore adapter factory changes

📊 Changes

2 files changed (+21 additions, -4 deletions)

View changed files

📝 packages/better-auth/src/db/with-hooks.ts (+14 -4)
📝 packages/better-auth/src/plugins/organization/organization.test.ts (+7 -0)

📄 Description

Summary by cubic

Fixes database update hooks to merge returned data with the original payload so partial updates don’t drop fields.

  • Bug Fixes

    • Merge hook result { data } into existing data instead of replacing it.
    • Preserve original fields when hooks return partial patches.
  • Refactors

    • Add session update hook to organization test setup.

Written for commit 78880a7d35. 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/5852 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 11/8/2025 **Status:** ✅ Merged **Merged:** 11/8/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/hooks` --- ### 📝 Commits (2) - [`eaba532`](https://github.com/better-auth/better-auth/commit/eaba5321626d8781a4b02904be3e08ddc64050c4) fix: update hooks return should merge with origial data - [`78880a7`](https://github.com/better-auth/better-auth/commit/78880a7d3523a78e0cda0b2bd28160933a17640d) restore adapter factory changes ### 📊 Changes **2 files changed** (+21 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/with-hooks.ts` (+14 -4) 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+7 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fixes database update hooks to merge returned data with the original payload so partial updates don’t drop fields. - **Bug Fixes** - Merge hook result `{ data }` into existing data instead of replacing it. - Preserve original fields when hooks return partial patches. - **Refactors** - Add session update hook to organization test setup. <sup>Written for commit 78880a7d3523a78e0cda0b2bd28160933a17640d. 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-15 21:32:02 -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#23178