Skip to content

feat(nextjs): export the remaining components, the React SDK hooks and the server actions - #566

Open
DonOmalVindula wants to merge 1 commit into
asgardeo:mainfrom
DonOmalVindula:fix/nextjs-missing-exports
Open

feat(nextjs): export the remaining components, the React SDK hooks and the server actions#566
DonOmalVindula wants to merge 1 commit into
asgardeo:mainfrom
DonOmalVindula:fix/nextjs-missing-exports

Conversation

@DonOmalVindula

Copy link
Copy Markdown
Contributor

Problem

  • Loading and OrganizationList exist in the package but were not exported.
  • The hooks needed alongside the components (useUser, useOrganization, useTranslation, useTheme, ...) were not re-exported, so applications had to import them from @asgardeo/react. @asgardeo/react is a dependency of this package, not a peer, so an application's own copy can end up as a second instance with unrelated React contexts and useUser() then returns nothing.
  • @asgardeo/nextjs/server exported only asgardeo and AsgardeoProvider. The server actions were unreachable, although clearSession's own JSDoc shows import {clearSession} from '@asgardeo/nextjs/server', and the asgardeo() helper had no way to check the session or read the user.

Fix

  • Client entry: Loading, OrganizationList (with their prop types) and the React SDK hooks are exported.
  • Server entry: the server actions are exported under stable names (clearSession, createOrganization, getAccessToken, getAllOrganizations, getMyOrganizations, getOrganization, getSessionId, getSessionPayload, getUser, getUserProfile, httpRequest, isSignedIn, refreshToken, signOut, switchOrganization, updateUserProfile) together with the SessionTokenPayload, RefreshResult and HttpRequestActionResult types.
  • asgardeo() gained isSignedIn, getSession, getUser, getUserProfile, signOut and clearSession, with a usage example in its JSDoc.

Testing

  • New test asserting the export surface of both entry points (62 tests pass), pnpm lint, tsc --noEmit.

Changeset included (@asgardeo/nextjs patch).

🤖 Generated with Claude Code

…d the server actions

- The client entry now exports Loading and OrganizationList, and re-exports
  the React SDK hooks (useUser, useOrganization, useTranslation, useTheme,
  useBrandingContext, useBranding, useFlow, useI18n, useForm) so apps do not
  need their own dependency on @asgardeo/react, which would bring a second
  copy of the contexts.
- The server entry exports the server actions (clearSession, isSignedIn,
  getSessionPayload, getUser, getUserProfile, httpRequest, signOut,
  switchOrganization, the organization actions, ...) as the JSDoc examples
  already assumed, and the asgardeo() helper gained isSignedIn, getSession,
  getUser, getUserProfile, signOut and clearSession.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 42 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 4d43fdac-400f-4439-86e7-ce79c7703ad6

📥 Commits

Reviewing files that changed from the base of the PR and between 409ebae and a6bcbb7.

📒 Files selected for processing (5)
  • .changeset/nextjs-missing-exports.md
  • packages/nextjs/src/__tests__/exports.test.ts
  • packages/nextjs/src/client/index.ts
  • packages/nextjs/src/server/asgardeo.ts
  • packages/nextjs/src/server/index.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@asgardeo-github-bot

Copy link
Copy Markdown

🦋 Changeset detected

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants