mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
feat: use @affine/debug (#1244)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// @ts-check
|
||||
import path from 'node:path';
|
||||
import debugLocal from 'next-debug-local';
|
||||
import preset from './preset.config.mjs';
|
||||
@@ -61,6 +62,7 @@ const nextConfig = {
|
||||
'@affine/component',
|
||||
'@affine/datacenter',
|
||||
'@affine/i18n',
|
||||
'@affine/debug',
|
||||
'@affine/env',
|
||||
],
|
||||
publicRuntimeConfig: {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"dependencies": {
|
||||
"@affine/component": "workspace:*",
|
||||
"@affine/datacenter": "workspace:*",
|
||||
"@affine/debug": "workspace:*",
|
||||
"@affine/env": "workspace:*",
|
||||
"@affine/i18n": "workspace:*",
|
||||
"@blocksuite/blocks": "0.4.1-20230220214107-0a354de",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Workspace } from '@affine/datacenter';
|
||||
import { config } from '@affine/env';
|
||||
import { config, getEnvironment } from '@affine/env';
|
||||
import { nanoid } from '@blocksuite/store';
|
||||
import { useCallback, useMemo, useSyncExternalStore } from 'react';
|
||||
import useSWR from 'swr';
|
||||
@@ -88,6 +88,9 @@ const emptyWorkspaces: RemWorkspace[] = [];
|
||||
export async function refreshDataCenter(signal?: AbortSignal) {
|
||||
dataCenter.isLoaded = false;
|
||||
dataCenter.callbacks.forEach(cb => cb());
|
||||
if (getEnvironment().isServer) {
|
||||
return;
|
||||
}
|
||||
// fixme(himself65): `prefetchWorkspace` is not used
|
||||
// use `config.enablePlugin = ['affine', 'local']` instead
|
||||
// if (!config.prefetchWorkspace) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import { config } from '@affine/env';
|
||||
import { assertEquals, nanoid } from '@blocksuite/store';
|
||||
import React from 'react';
|
||||
@@ -16,6 +17,8 @@ import {
|
||||
import { createEmptyBlockSuiteWorkspace } from '../../utils';
|
||||
import { WorkspacePlugin } from '..';
|
||||
|
||||
const logger = new DebugLogger('local-plugin');
|
||||
|
||||
export const kStoreKey = 'affine-local-workspace';
|
||||
|
||||
export const LocalPlugin: WorkspacePlugin<RemWorkspaceFlavour.LOCAL> = {
|
||||
@@ -134,7 +137,7 @@ export const LocalPlugin: WorkspacePlugin<RemWorkspaceFlavour.LOCAL> = {
|
||||
if (signal?.aborted) {
|
||||
return;
|
||||
}
|
||||
console.info('no local workspace found, create a new one');
|
||||
logger.info('no local workspace found, create a new one');
|
||||
const workspaceId = nanoid();
|
||||
const blockSuiteWorkspace = createEmptyBlockSuiteWorkspace(workspaceId);
|
||||
blockSuiteWorkspace.meta.setName('Untitled Workspace');
|
||||
|
||||
Reference in New Issue
Block a user