fix(core): rerender (#4988)

This commit is contained in:
EYHN 2023-11-20 17:32:40 +08:00 committed by GitHub
parent c127d449a1
commit 899e46b1fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@ import { type User } from '@affine/component/auth-components';
import type { DefaultSession, Session } from 'next-auth';
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { getSession, useSession } from 'next-auth/react';
import { useEffect, useReducer } from 'react';
import { useEffect, useMemo, useReducer } from 'react';
import { SessionFetchErrorRightAfterLoginOrSignUp } from '../../unexpected-application-state/errors';
@ -97,6 +97,7 @@ export function useCurrentUser(): CheckedUser {
const user = session.user;
return useMemo(() => {
return {
id: user.id,
name: user.name,
@ -105,4 +106,5 @@ export function useCurrentUser(): CheckedUser {
hasPassword: user?.hasPassword ?? false,
update,
};
}, [user, update]);
}