Skip to content

Commit ec02f29

Browse files
Fix(logout): use setTimeout instead of requestAnimationFrame to ensure we reach the next event loop when resetting the permissions store
1 parent 81f32d7 commit ec02f29

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/ra-core/src/auth/useLogout.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ const useLogout = (): Logout => {
123123
// a resolved promise with no delay: If the store was reset before the navigation,
124124
// the `usePermissions` query would reset, causing the `CoreAdminRoutes` component to
125125
// rerender the `LogoutOnMount` component leading to an infinite loop.
126-
window.requestAnimationFrame(() => {
126+
setTimeout(() => {
127127
resetStore();
128128
queryClient.clear();
129-
});
129+
}, 0);
130130

131131
return redirectToFromProvider;
132132
});

0 commit comments

Comments
 (0)