refactor: using unified nanoid (#4519)

This commit is contained in:
Alex Yang
2023-09-27 21:53:04 -05:00
committed by GitHub
parent 56f75160f3
commit 603f82ffc2
38 changed files with 258 additions and 183 deletions

View File

@@ -60,7 +60,7 @@ describe('crud', () => {
expect(localWorkspace.blockSuiteWorkspace.doc.toJSON()).toEqual({
meta: expect.anything(),
spaces: expect.objectContaining({
'space:page0': expect.anything(),
page0: expect.anything(),
}),
});

View File

@@ -1,8 +1,9 @@
import { DebugLogger } from '@affine/debug';
import type { LocalWorkspace, WorkspaceCRUD } from '@affine/env/workspace';
import { WorkspaceFlavour } from '@affine/env/workspace';
import { nanoid, Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
import { Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
import { createJSONStorage } from 'jotai/utils';
import { nanoid } from 'nanoid';
import { z } from 'zod';
import { getOrCreateWorkspace } from '../manager';

View File

@@ -76,7 +76,7 @@ describe('download provider', () => {
...prev,
// download provider only download the root doc
spaces: {
'space:page0': {
page0: {
blocks: {},
},
},

View File

@@ -5,12 +5,13 @@ import type {
import { getDoc } from '@affine/y-provider';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import type { Y as YType } from '@blocksuite/store';
import { Schema, uuidv4, Workspace } from '@blocksuite/store';
import { Schema, Workspace } from '@blocksuite/store';
import type { DBHandlerManager } from '@toeverything/infra/handler';
import type {
EventMap,
UnwrapManagerHandlerToClientSide,
} from '@toeverything/infra/type';
import { nanoid } from 'nanoid';
import { setTimeout } from 'timers/promises';
import { beforeEach, describe, expect, test, vi } from 'vitest';
@@ -79,7 +80,7 @@ const schema = new Schema();
schema.register(AffineSchemas).register(__unstableSchemas);
beforeEach(() => {
id = uuidv4();
id = nanoid();
workspace = new Workspace({
id,
isSSR: true,