mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-20 07:47:19 +08:00
refactor(core): refactor atom to use di (#5831)
To support multiple instances, this PR removes some atoms and implements them using the new DI system. removed atom - `pageSettingsAtom` - `currentPageIdAtom` - `currentModeAtom`
This commit is contained in:
@@ -264,6 +264,7 @@ test('assert the recent browse pages are on the recent list', async ({
|
||||
{
|
||||
const title = getBlockSuiteEditorTitle(page);
|
||||
await title.click();
|
||||
await page.waitForTimeout(200);
|
||||
await title.pressSequentially('sgtokidoki', { delay: 100 });
|
||||
await expect(title).toHaveText('sgtokidoki');
|
||||
}
|
||||
@@ -276,6 +277,7 @@ test('assert the recent browse pages are on the recent list', async ({
|
||||
{
|
||||
const title = getBlockSuiteEditorTitle(page);
|
||||
await title.click();
|
||||
await page.waitForTimeout(200);
|
||||
await title.pressSequentially('theliquidhorse', { delay: 100 });
|
||||
await expect(title).toHaveText('theliquidhorse');
|
||||
}
|
||||
@@ -288,6 +290,7 @@ test('assert the recent browse pages are on the recent list', async ({
|
||||
{
|
||||
const title = getBlockSuiteEditorTitle(page);
|
||||
await title.click();
|
||||
await page.waitForTimeout(200);
|
||||
await title.pressSequentially('battlekot', { delay: 100 });
|
||||
await expect(title).toHaveText('battlekot');
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||
import { Workspace } from '@blocksuite/store';
|
||||
import { Schema } from '@blocksuite/store';
|
||||
import type { StoryFn } from '@storybook/react';
|
||||
import { initEmptyPage } from '@toeverything/infra/blocksuite';
|
||||
import { initEmptyPage } from '@toeverything/infra';
|
||||
|
||||
const schema = new Schema();
|
||||
schema.register(AffineSchemas).register(__unstableSchemas);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CurrentPageService } from '@affine/core/modules/page';
|
||||
import type { Page } from '@blocksuite/store';
|
||||
import type { Meta } from '@storybook/react';
|
||||
import { PageManager, useService, Workspace } from '@toeverything/infra';
|
||||
import { initEmptyPage } from '@toeverything/infra/blocksuite';
|
||||
import { initEmptyPage } from '@toeverything/infra';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
|
||||
@@ -24,7 +24,7 @@ export const Default = () => {
|
||||
const bsPage = workspace.blockSuiteWorkspace.createPage('page0');
|
||||
initEmptyPage(bsPage);
|
||||
|
||||
const { page, release } = pageManager.open(bsPage.meta);
|
||||
const { page, release } = pageManager.open(bsPage.meta.id);
|
||||
currentPageService.openPage(page);
|
||||
|
||||
fetch(new URL('@affine-test/fixtures/large-image.png', import.meta.url))
|
||||
|
||||
@@ -3,7 +3,7 @@ import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||
import { Workspace } from '@blocksuite/store';
|
||||
import { Schema } from '@blocksuite/store';
|
||||
import type { StoryFn } from '@storybook/react';
|
||||
import { initEmptyPage } from '@toeverything/infra/blocksuite';
|
||||
import { initEmptyPage } from '@toeverything/infra';
|
||||
|
||||
const schema = new Schema();
|
||||
schema.register(AffineSchemas).register(__unstableSchemas);
|
||||
|
||||
@@ -18,7 +18,7 @@ import { PageIcon, TagsIcon } from '@blocksuite/icons';
|
||||
import { Schema, Workspace } from '@blocksuite/store';
|
||||
import type { Meta, StoryFn } from '@storybook/react';
|
||||
import { userEvent } from '@storybook/testing-library';
|
||||
import { initEmptyPage } from '@toeverything/infra/blocksuite';
|
||||
import { initEmptyPage } from '@toeverything/infra';
|
||||
import { useState } from 'react';
|
||||
import { withRouter } from 'storybook-addon-react-router-v6';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { type Page } from '@blocksuite/store';
|
||||
import { expect } from '@storybook/jest';
|
||||
import type { Meta, StoryFn } from '@storybook/react';
|
||||
import { Workspace } from '@toeverything/infra';
|
||||
import { initEmptyPage } from '@toeverything/infra/blocksuite';
|
||||
import { initEmptyPage } from '@toeverything/infra';
|
||||
import { useService } from '@toeverything/infra/di';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
Reference in New Issue
Block a user