mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-22 08:47:10 +08:00
ci(core): eslint errors for core (#4662)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { WorkspaceSubPath } from '@affine/env/workspace';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks';
|
||||
import { useAtom } from 'jotai';
|
||||
import type { ReactElement } from 'react';
|
||||
import { lazy, Suspense, useCallback } from 'react';
|
||||
@@ -154,13 +155,10 @@ export const SignOutConfirmModal = () => {
|
||||
const { jumpToIndex } = useNavigateHelper();
|
||||
const [open, setOpen] = useAtom(openSignOutModalAtom);
|
||||
|
||||
const onConfirm = useCallback(async () => {
|
||||
const onConfirm = useAsyncCallback(async () => {
|
||||
setOpen(false);
|
||||
signOutCloud()
|
||||
.then(() => {
|
||||
jumpToIndex();
|
||||
})
|
||||
.catch(console.error);
|
||||
await signOutCloud();
|
||||
jumpToIndex();
|
||||
}, [jumpToIndex, setOpen]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,6 +3,7 @@ import '@toeverything/hooks/use-affine-ipc-renderer';
|
||||
import { pushNotificationAtom } from '@affine/component/notification-center';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { refreshRootMetadataAtom } from '@affine/workspace/atom';
|
||||
import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks';
|
||||
import { useAtom, useSetAtom } from 'jotai';
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
||||
import { SessionProvider, useSession } from 'next-auth/react';
|
||||
@@ -24,6 +25,12 @@ const SessionDefence = (props: PropsWithChildren) => {
|
||||
const refreshMetadata = useSetAtom(refreshRootMetadataAtom);
|
||||
const onceSignedInEvents = useOnceSignedInEvents();
|
||||
const t = useAFFiNEI18N();
|
||||
|
||||
const refreshAfterSignedInEvents = useAsyncCallback(async () => {
|
||||
await onceSignedInEvents();
|
||||
refreshMetadata();
|
||||
}, [onceSignedInEvents, refreshMetadata]);
|
||||
|
||||
useEffect(() => {
|
||||
if (sessionInAtom !== session && session.status === 'authenticated') {
|
||||
setSession(session);
|
||||
@@ -35,11 +42,7 @@ const SessionDefence = (props: PropsWithChildren) => {
|
||||
prevSession.current?.status === 'unauthenticated' &&
|
||||
session.status === 'authenticated'
|
||||
) {
|
||||
startTransition(() => {
|
||||
onceSignedInEvents().then(() => {
|
||||
refreshMetadata();
|
||||
});
|
||||
});
|
||||
startTransition(() => refreshAfterSignedInEvents());
|
||||
pushNotification({
|
||||
title: t['com.affine.auth.has.signed'](),
|
||||
message: t['com.affine.auth.has.signed.message'](),
|
||||
@@ -57,9 +60,8 @@ const SessionDefence = (props: PropsWithChildren) => {
|
||||
sessionInAtom,
|
||||
prevSession,
|
||||
setSession,
|
||||
onceSignedInEvents,
|
||||
pushNotification,
|
||||
refreshMetadata,
|
||||
refreshAfterSignedInEvents,
|
||||
t,
|
||||
]);
|
||||
return props.children;
|
||||
|
||||
Reference in New Issue
Block a user