[PR #2999] [MERGED] fix(organization): organization with no members error #4596

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2999
Author: @seanlucakrueger
Created: 6/12/2025
Status: Merged
Merged: 6/12/2025
Merged by: @Bekacru

Base: mainHead: fix--organization-with-no-members


📝 Commits (3)

  • 34b8baa fix: handle empty userIds in getOrgAdapter to prevent errors
  • a4e6cab refactor: remove unnecessary whitespace in getOrgAdapter function
  • 6a05365 refactor: simplify user fetching logic in getOrgAdapter function

📊 Changes

1 file changed (+8 additions, -5 deletions)

View changed files

📝 packages/better-auth/src/plugins/organization/adapter.ts (+8 -5)

📄 Description

This pull request includes a small but important improvement to the getOrgAdapter function in packages/better-auth/src/plugins/organization/adapter.ts. The change ensures that the findMany query is only executed if there are user IDs to query, avoiding unnecessary database calls when the userIds array is empty. There are also errors when no users belong to an organization.


🔄 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/2999 **Author:** [@seanlucakrueger](https://github.com/seanlucakrueger) **Created:** 6/12/2025 **Status:** ✅ Merged **Merged:** 6/12/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `fix--organization-with-no-members` --- ### 📝 Commits (3) - [`34b8baa`](https://github.com/better-auth/better-auth/commit/34b8baa3438c338b31ea6b83bdebd6955f4b3c1b) fix: handle empty userIds in getOrgAdapter to prevent errors - [`a4e6cab`](https://github.com/better-auth/better-auth/commit/a4e6cabea336b2675ded6e41c597ad8169def47c) refactor: remove unnecessary whitespace in getOrgAdapter function - [`6a05365`](https://github.com/better-auth/better-auth/commit/6a0536596bca280203d5c87d9d15623de9388f1d) refactor: simplify user fetching logic in getOrgAdapter function ### 📊 Changes **1 file changed** (+8 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/organization/adapter.ts` (+8 -5) </details> ### 📄 Description This pull request includes a small but important improvement to the `getOrgAdapter` function in `packages/better-auth/src/plugins/organization/adapter.ts`. The change ensures that the `findMany` query is only executed if there are user IDs to query, avoiding unnecessary database calls when the `userIds` array is empty. There are also errors when no users belong to an organization. --- <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 11:52: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#4596