Kabeer
Kabeer
BABetter Auth
Created by Risatoga on 3/7/2025 in #bug-reports
useSession not reactive?
// Method 2: Using direct object methods - This works too
authClient.signIn(...);
authClient.useSession();
// Method 2: Using direct object methods - This works too
authClient.signIn(...);
authClient.useSession();
I was using this across the code base , but still had the same problem Currenly my fix - calling refetch in root wrapper (seems to work)
export default function AppWrapper({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const { data, isPending, refetch } = authClient.useSession();

useLayoutEffect(() => {
useSettings.persist.rehydrate();
refetch(); // <- Added This
}, []);

console.log(isPending);

return (
<>
<Navbar/>
{children}
{isPending && <PageLoader />}
</>
);
}
function PageLoader() {
return (
<div className="fixed inset-0 z-50 grid place-items-center">
<div className="bg-foreground/40 absolute inset-0 backdrop-blur-xs" />
<LoaderCircle
className="text-border relative z-50 animate-spin"
size={70}
/>
</div>
);
}
export default function AppWrapper({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const { data, isPending, refetch } = authClient.useSession();

useLayoutEffect(() => {
useSettings.persist.rehydrate();
refetch(); // <- Added This
}, []);

console.log(isPending);

return (
<>
<Navbar/>
{children}
{isPending && <PageLoader />}
</>
);
}
function PageLoader() {
return (
<div className="fixed inset-0 z-50 grid place-items-center">
<div className="bg-foreground/40 absolute inset-0 backdrop-blur-xs" />
<LoaderCircle
className="text-border relative z-50 animate-spin"
size={70}
/>
</div>
);
}
45 replies
BABetter Auth
Created by Kabeer on 3/22/2025 in #help
Wierd behaviour, isPending from useSession not triggering
// Method 2: Using direct object methods - This works too
authClient.signIn(...);
authClient.useSession();
// Method 2: Using direct object methods - This works too
authClient.signIn(...);
authClient.useSession();
Im currently using this method across everywhere. But still same, (It still has reactivity issues)(Sometimes) i tried setting up a simple POC, But everything seem to be working fine (Couldn't replicate the issue) ill look into my codebase further, will update further if i find the cause
5 replies
BABetter Auth
Created by Kabeer on 1/25/2025 in #bug-reports
Failed to get session, when remember me is checked
My bad. wierd but i had this database hook to update lastActive of user
databaseHooks: {
session: {
update: {
before: async (session) => {
await db
.update(users)
.set({
lastActive: new Date(),
})
.where(eq(users.id, session.userId!));
},
},
},
},
databaseHooks: {
session: {
update: {
before: async (session) => {
await db
.update(users)
.set({
lastActive: new Date(),
})
.where(eq(users.id, session.userId!));
},
},
},
},
In before session just contained expiresAt after updating to after was getting full session object and everything worked as expected.
2 replies
BABetter Auth
Created by Kabeer on 1/11/2025 in #bug-reports
Anonymous user account getting deleted on calling /get-session
Yap works ❤️ 👍
5 replies
BABetter Auth
Created by Kabeer on 1/11/2025 in #bug-reports
Anonymous user account getting deleted on calling /get-session
OK. User Getting deleted has been fixed in v1.1.11 but account linking might have some problem. Need to test more
5 replies
BABetter Auth
Created by Kabeer on 1/11/2025 in #bug-reports
Anonymous user account getting deleted on calling /get-session
im using const { data } = authClient.useSession(); which calls server endpoint
5 replies
BABetter Auth
Created by Bart ⚡ on 1/10/2025 in #help
Magic link on mobile app
4 replies
BABetter Auth
Created by Kabeer on 12/23/2024 in #help
TOTP URI Error After getting scanned by Google Authenticator
The totpURI generated in versions before v1.1.0 works v1.0.22 -> Works
4 replies
BABetter Auth
Created by Kabeer on 12/23/2024 in #help
TOTP URI Error After getting scanned by Google Authenticator
im on v1.1.2
4 replies