fix: flaky tests (#3507)

This commit is contained in:
Peng Xiao 2023-08-01 22:13:04 +08:00 committed by GitHub
parent 70f3508005
commit 35a4c63c27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 7 deletions

View File

@ -8,7 +8,13 @@ import {
} from '@toeverything/plugin-infra/atom';
import { useAtom, useAtomValue, useSetAtom } from 'jotai';
import type { FC, ReactElement } from 'react';
import { lazy, Suspense, useCallback, useTransition } from 'react';
import {
lazy,
startTransition,
Suspense,
useCallback,
useTransition,
} from 'react';
import type { SettingAtom } from '../atoms';
import {
@ -195,11 +201,13 @@ export const AllWorkspaceModals = (): ReactElement => {
setOpenCreateWorkspaceModal(false);
}, [setOpenCreateWorkspaceModal])}
onCreate={useCallback(
async id => {
id => {
startTransition(() => {
setOpenCreateWorkspaceModal(false);
setOpenWorkspacesModal(false);
setCurrentWorkspaceId(id);
return jumpToSubPath(id, WorkspaceSubPath.ALL);
jumpToSubPath(id, WorkspaceSubPath.ALL);
});
},
[
jumpToSubPath,

View File

@ -14,7 +14,7 @@ import { localProviderLogger as logger } from './logger';
const Y = BlockSuiteWorkspace.Y;
const sqliteOrigin = Symbol('sqlite-provider-origin');
const sqliteOrigin = 'sqlite-provider-origin';
const createDatasource = (workspaceId: string): DatasourceDocAdapter => {
if (!window.apis?.db) {