[PR #3850] [CLOSED] fix(client): properly sync session state when activeOrg changes #13295

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3850
Author: @Kinfe123
Created: 8/7/2025
Status: Closed

Base: canaryHead: fix/active-org-trigger-session


📝 Commits (7)

  • 484b3e5 docs: unify component implementations for consistency (#3799)
  • a3c1d28 docs: update TOTP 2FA docs to state that Better-Auth implements a delay window (#3586)
  • aa5723d fix(client): properly sync session state when activeOrg changes
  • f44cdca cut network call
  • 79ada00 lint
  • d5ae098 Merge branch 'canary' into fix/active-org-trigger-session
  • 172110a Merge branch 'canary' into fix/active-org-trigger-session

📊 Changes

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

View changed files

📝 docs/components/landing/section-svg.tsx (+5 -1)
📝 packages/better-auth/src/plugins/organization/client.ts (+26 -0)

📄 Description

closes #3837

This pr fixes the issue of session get refreshed with just one patch call with active org id triggering the getFullOrg and make sure session atom also get updated on the batch.

  • Update session atom when organization changes
  • Add explicit state notifications in setActive
  • Fix stale session data in useSession hook

Summary by cubic

Fixed session state so it updates immediately when the active organization changes.

  • Bug Fixes
  • Updated the setActive action to sync the session atom and notify listeners after changing the active 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/3850 **Author:** [@Kinfe123](https://github.com/Kinfe123) **Created:** 8/7/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/active-org-trigger-session` --- ### 📝 Commits (7) - [`484b3e5`](https://github.com/better-auth/better-auth/commit/484b3e5310aedaaee36b83579d35966053337f49) docs: unify component implementations for consistency (#3799) - [`a3c1d28`](https://github.com/better-auth/better-auth/commit/a3c1d2842a352136025d7d49791699607d0bd46c) docs: update TOTP 2FA docs to state that Better-Auth implements a delay window (#3586) - [`aa5723d`](https://github.com/better-auth/better-auth/commit/aa5723d06866bb1619d11f3858961323f637280b) fix(client): properly sync session state when activeOrg changes - [`f44cdca`](https://github.com/better-auth/better-auth/commit/f44cdca19d520181c70d54b71d2cc15ac7e66098) cut network call - [`79ada00`](https://github.com/better-auth/better-auth/commit/79ada0010ab08402170623addacb69986f840d50) lint - [`d5ae098`](https://github.com/better-auth/better-auth/commit/d5ae098cf850ef1430ffabf3ec15dd7ddfada51d) Merge branch 'canary' into fix/active-org-trigger-session - [`172110a`](https://github.com/better-auth/better-auth/commit/172110a5b866bee69fa16ab0636d66a431824aca) Merge branch 'canary' into fix/active-org-trigger-session ### 📊 Changes **2 files changed** (+31 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/components/landing/section-svg.tsx` (+5 -1) 📝 `packages/better-auth/src/plugins/organization/client.ts` (+26 -0) </details> ### 📄 Description closes #3837 This pr fixes the issue of session get refreshed with just one patch call with active org id triggering the getFullOrg and make sure session atom also get updated on the batch. - Update session atom when organization changes - Add explicit state notifications in setActive - Fix stale session data in useSession hook <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fixed session state so it updates immediately when the active organization changes. - **Bug Fixes** - Updated the setActive action to sync the session atom and notify listeners after changing the active organization. <!-- 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 08:51:31 -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#13295