There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fixbug There is a bug in the rename workspace name function in doc mode #15
xiaodong zuo86faaadbe8df
diff --git a/apps/ligo-virgo/src/pages/workspace/docs/workspace-name.tsx b/apps/ligo-virgo/src/pages/workspace/docs/workspace-name.tsxindex 6b353cf43d..24d69b659a 100644--- a/apps/ligo-virgo/src/pages/workspace/docs/workspace-name.tsx+++ b/apps/ligo-virgo/src/pages/workspace/docs/workspace-name.tsx@@ -9,7 +9,7 @@ import {useUserAndSpaces,useShowSpaceSidebar,} from '@toeverything/datasource/state';-import { useCallback, useEffect, useState } from 'react';+import { useCallback, useEffect, useRef, useState } from 'react';import { services } from '@toeverything/datasource/db-service';const WorkspaceContainer = styled('div')({@@ -78,6 +78,7 @@ export const WorkspaceName = () => {const { fixedDisplay, toggleSpaceSidebar } = useShowSpaceSidebar();const [inRename, setInRename] = useState(false);const [workspaceName, setWorkspaceName] = useState('');+ const [workspaceId, setWorkspaceId] = useState('');const fetchWorkspaceName = useCallback(async () => {if (!currentSpaceId) {@@ -88,6 +89,11 @@ export const WorkspaceName = () => {currentSpaceId);setWorkspaceName(name);++ const workspaceId = await services.api.userConfig.getWorkspaceId(+ currentSpaceId+ );+ setWorkspaceId(workspaceId);}, [currentSpaceId]);useEffect(() => {@@ -150,7 +156,7 @@ export const WorkspaceName = () => {) : (<WorkspaceNameContainer><span onClick={() => setInRename(true)}>- {workspaceName}+ {workspaceName || workspaceId}</span></WorkspaceNameContainer>)}diff --git a/libs/datasource/db-service/src/services/workspace/user-config.ts b/libs/datasource/db-service/src/services/workspace/user-config.tsindex 0977ee9092..0a5dca7eef 100644--- a/libs/datasource/db-service/src/services/workspace/user-config.ts+++ b/libs/datasource/db-service/src/services/workspace/user-config.ts@@ -112,11 +112,15 @@ export class UserConfig extends ServiceBaseClass {async getWorkspaceName(workspace: string): Promise<string> {const workspace_db_block = await this.getWorkspaceDbBlock(workspace);const workspaceName =- workspace_db_block.getDecoration<string>(WORKSPACE_CONFIG) ||- workspace_db_block.id;+ workspace_db_block.getDecoration<string>(WORKSPACE_CONFIG) || '';return workspaceName;}+ async getWorkspaceId(workspace: string): Promise<string> {+ const workspace_db_block = await this.getWorkspaceDbBlock(workspace);+ return workspace_db_block.id;+ }+async setWorkspaceName(workspace: string, workspaceName: string) {const workspace_db_block = await this.getWorkspaceDbBlock(workspace);workspace_db_block.setDecoration(WORKSPACE_CONFIG, workspaceName);