Skip to content

Commit c2fa629

Browse files
fix(ui): update memory user when autoLogin enabled (#14018)
Fixes #14005 When `autoLogin` is enabled, the Auth Provider's user in memory becomes stale. This change ensures the user in memory stays up to date if `autoLogin && !autoLogin.prefillOnly` is set.
1 parent 7e12880 commit c2fa629

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/ui/src/providers/Auth/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export function AuthProvider({
5959

6060
const {
6161
admin: {
62+
autoLogin,
6263
autoRefresh,
6364
routes: { inactivity: logoutInactivityRoute },
6465
user: userSlug,
@@ -303,6 +304,12 @@ export function AuthProvider({
303304
void fetchUserOnMount()
304305
}, [])
305306

307+
useEffect(() => {
308+
if (!user && autoLogin && !autoLogin.prefillOnly) {
309+
void fetchFullUserEvent()
310+
}
311+
}, [user, autoLogin])
312+
306313
useEffect(
307314
() => () => {
308315
// remove all timeouts on unmount

0 commit comments

Comments
 (0)