Skip to content

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.

Bugfix/delete log (#315)

DiamondThree617e9a061256
diff --git a/libs/components/affine-board/src/Board.tsx b/libs/components/affine-board/src/Board.tsx
index 101d54d37b..9936d115a0 100644
--- a/libs/components/affine-board/src/Board.tsx
+++ b/libs/components/affine-board/src/Board.tsx
@@ -52,6 +52,7 @@ const AffineBoard = ({
});
const { shapes, bindings } = useShapes(workspace, rootBlockId);
+
useEffect(() => {
if (app) {
app.replacePageContent(shapes || {}, bindings, {});
@@ -109,7 +110,6 @@ const AffineBoard = ({
});
}
shape.affineId = block.id;
-
Object.keys(bindings).forEach(bilingKey => {
if (
bindings[bilingKey]?.fromId === shape.id
@@ -148,7 +148,8 @@ const AffineBoard = ({
Object.assign(pageBindings, bindings);
}
});
- services.api.editorBlock.update({
+
+ await services.api.editorBlock.update({
workspace: workspace,
id: rootBlockId,
properties: {
diff --git a/libs/components/affine-board/src/hooks/use-shapes.ts b/libs/components/affine-board/src/hooks/use-shapes.ts
index beb8c50efa..ba1bf066ff 100644
--- a/libs/components/affine-board/src/hooks/use-shapes.ts
+++ b/libs/components/affine-board/src/hooks/use-shapes.ts
@@ -12,7 +12,7 @@ const getBindings = (workspace: string, rootBlockId: string) => {
ids: [rootBlockId],
})
.then(blcoks => {
- return blcoks[0].properties.bindings?.value;
+ return blcoks[0]?.properties.bindings?.value;
});
};
@@ -104,6 +104,7 @@ export const useShapes = (workspace: string, rootBlockId: string) => {
return acc;
}, {} as Record<string, TDShape>);
+
return {
shapes: blocksShapes,
bindings: JSON.parse(blocks?.bindings ?? '{}'),
diff --git a/libs/components/board-draw/src/components/command-panel/ArrowTo.tsx b/libs/components/board-draw/src/components/command-panel/ArrowTo.tsx
index 21f37a9fbc..84ef142ef0 100644
--- a/libs/components/board-draw/src/components/command-panel/ArrowTo.tsx
+++ b/libs/components/board-draw/src/components/command-panel/ArrowTo.tsx
@@ -21,6 +21,9 @@ export const ArrowTo = ({ app, shapes }: GroupAndUnGroupProps) => {
let activeShape = shapes[0];
let toNextShapBindings: ArrowBinding[] = [];
let bindingId = '';
+ if (!activeShape) {
+ return;
+ }
Object.keys(bindings).forEach(key => {
if (bindings[key].toId === activeShape.id) {
bindingId = bindings[key].fromId;
@@ -35,7 +38,6 @@ export const ArrowTo = ({ app, shapes }: GroupAndUnGroupProps) => {
toNextShapBindings.forEach(binding => {
if (binding.toId !== activeShape.id) {
allShape.forEach(item => {
- console.log(item);
if (item.id === binding.toId) {
ArrowToArr.push(item);
}
@@ -44,7 +46,7 @@ export const ArrowTo = ({ app, shapes }: GroupAndUnGroupProps) => {
});
setarrowToArr(ArrowToArr);
return () => {};
- }, [app.page.bindings, app.shapes]);
+ }, [app.page.bindings]);
const jumpToNextShap = (shape: TDShape) => {
app.zoomToShapes([shape]);
};
@@ -68,7 +70,7 @@ export const ArrowTo = ({ app, shapes }: GroupAndUnGroupProps) => {
</div>
}
>
- <Tooltip content="Font Size" placement="top-start">
+ <Tooltip content="ArrowToEditor" placement="top-start">
<IconButton>
<ConnectorIcon></ConnectorIcon>
</IconButton>
diff --git a/libs/components/board-state/src/tldraw-app.ts b/libs/components/board-state/src/tldraw-app.ts
index 34a392db72..98bffcf654 100644
--- a/libs/components/board-state/src/tldraw-app.ts
+++ b/libs/components/board-state/src/tldraw-app.ts
@@ -626,7 +626,7 @@ export class TldrawApp extends StateManager<TDSnapshot> {
private prev_bindings = this.page.bindings;
private prev_assets = this.document.assets;
- private _broadcastPageChanges = () => {
+ private _broadcastPageChanges = async () => {
const visited = new Set<string>();
const changedShapes: Record<string, TDShape | undefined> = {};
@@ -683,7 +683,7 @@ export class TldrawApp extends StateManager<TDSnapshot> {
Object.keys(changedAssets).length > 0
) {
this.just_sent = true;
- this.callbacks.onChangePage?.(
+ await this.callbacks.onChangePage?.(
this,
changedShapes,
changedBindings,
diff --git a/libs/components/common/src/lib/text/EditableText.tsx b/libs/components/common/src/lib/text/EditableText.tsx
index 8637246d7d..b2b2229fec 100644
--- a/libs/components/common/src/lib/text/EditableText.tsx
+++ b/libs/components/common/src/lib/text/EditableText.tsx
@@ -804,7 +804,7 @@ const EditorLeaf = ({ attributes, children, leaf }: any) => {
backgroundColor: '#F2F5F9',
borderRadius: '5px',
color: '#3A4C5C',
- padding: '3px 8px',
+ padding: '1px 8px',
margin: '0 2px',
}}
>