Infinite Call Using Organizations
Hey there, so I'm trying to get this to work, but when I open my app it keeps fetching the following endpoint on and on.
GET /api/auth/organization/list 200 in 45ms
I'm using it like this:
const authClient = createAuthClient({
baseURL: getBaseUrl(),
plugins: [
organizationClient({
teams: {
enabled: true
}
}),
]
});
const { data } = authClient.useListOrganizations();
console.log(data)
this is my auth.ts file
import { betterAuth } from "better-auth";
import { nextCookies } from "better-auth/next-js";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { organization } from "better-auth/plugins"
import { db } from "@ideate/server/db";
export const auth = betterAuth({
plugins: [
organization({
teams: {
enabled: true,
maximumTeams: 10,
allowRemovingAllTeams: true,
}
}),
nextCookies()
],
database: drizzleAdapter(db, {
provider: "pg",
}),
});
Am I missing something?
3 Replies
I created the issue in the github repo with more details, please refer to: https://github.com/better-auth/better-auth/issues/1703
GitHub
Infinite Fetching Organizations · Issue #1703 · better-auth/better-...
Is this suited for github? Yes, this is suited for github To Reproduce Create an T3 Stack app. migrate from NextAuth.js to BetterAuth.js. Implement BetterAuth with Organizations. try to use both au...
Any thoughts?
The list hook is triggered by an action that updates, creates, or deletes an org. Make sure none of these actions are being called as a side effect.