ci(core): eslint errors for core (#4662)

This commit is contained in:
Joooye_34
2023-11-10 18:25:59 +08:00
committed by GitHub
parent b98a258083
commit 30bac7dce2
44 changed files with 264 additions and 140 deletions

View File

@@ -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 (

View File

@@ -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;