mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 13:02:21 +08:00
fix(component): cmdk flaky (#4512)
This commit is contained in:
@@ -3,6 +3,7 @@ import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom';
|
||||
import { getOrCreateWorkspace } from '@affine/workspace/manager';
|
||||
import type { Page } from '@blocksuite/store';
|
||||
import type { Meta, StoryFn } from '@storybook/react';
|
||||
import { currentWorkspaceIdAtom } from '@toeverything/infra/atom';
|
||||
import {
|
||||
@@ -21,6 +22,13 @@ export default {
|
||||
},
|
||||
} satisfies Meta;
|
||||
|
||||
const createMockedPage = () => {
|
||||
return {
|
||||
id: 'test-page',
|
||||
waitForLoaded: () => Promise.resolve(),
|
||||
} as any as Page;
|
||||
};
|
||||
|
||||
function useRegisterCommands() {
|
||||
const t = useAFFiNEI18N();
|
||||
const store = useStore();
|
||||
@@ -39,8 +47,8 @@ function useRegisterCommands() {
|
||||
t,
|
||||
store,
|
||||
pageHelper: {
|
||||
createEdgeless: () => 'noop',
|
||||
createPage: () => 'noop',
|
||||
createEdgeless: createMockedPage,
|
||||
createPage: createMockedPage,
|
||||
importFile: () => Promise.resolve(),
|
||||
isPreferredEdgeless: () => false,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user