From dc047aa1a4b7afba9e76a0449769eaeaa2631038 Mon Sep 17 00:00:00 2001 From: Saul-Mirone Date: Fri, 7 Mar 2025 15:57:12 +0000 Subject: [PATCH] feat(editor): allow undefined default props (#10701) Closes: [BS-2771](https://linear.app/affine-design/issue/BS-2771/%E6%84%9F%E8%A7%89%E5%BE%97%E6%94%AF%E6%8C%81%E5%8F%AF%E9%80%89%E5%AD%97%E6%AE%B5[mirone]1f862b1b-8523-4487-a948-fef9174e8825) --- .../framework/store/src/model/block/flat-sync-controller.ts | 1 + blocksuite/framework/store/src/model/block/sync-controller.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) 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); }); }