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.

feat(editor): allow undefined default props (#10701)

Saul-Mironedc047aa1a4b7
diff --git a/blocksuite/framework/store/src/model/block/flat-sync-controller.ts b/blocksuite/framework/store/src/model/block/flat-sync-controller.ts
index 7c58734bb6..ce60588204 100644
--- a/blocksuite/framework/store/src/model/block/flat-sync-controller.ts
+++ b/blocksuite/framework/store/src/model/block/flat-sync-controller.ts
@@ -72,6 +72,7 @@ export class FlatSyncController {
if (key in proxy) {
return;
}
+ if (value === undefined) return;
proxy[key] = value;
});
}
diff --git a/blocksuite/framework/store/src/model/block/sync-controller.ts b/blocksuite/framework/store/src/model/block/sync-controller.ts
index 50c817e5b6..55346347f1 100644
--- a/blocksuite/framework/store/src/model/block/sync-controller.ts
+++ b/blocksuite/framework/store/src/model/block/sync-controller.ts
@@ -302,7 +302,9 @@ export class SyncController {
if (key in props) return;
const yValue = native2Y(value);
- this.yBlock.set(`prop:${key}`, yValue);
+ if (value !== undefined) {
+ this.yBlock.set(`prop:${key}`, yValue);
+ }
props[key] = this._getPropsProxy(key, yValue);
});
}