From 773db7860a249a64131c682faf58c15fcbb27e22 Mon Sep 17 00:00:00 2001 From: Saul-Mirone Date: Thu, 3 Apr 2025 09:22:26 +0000 Subject: [PATCH] feat(editor): not sync selection from awareness (#11420) --- .../src/extension/selection/selection-extension.ts | 10 +--------- tests/affine-local/e2e/peek-view.spec.ts | 1 + 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/blocksuite/framework/store/src/extension/selection/selection-extension.ts b/blocksuite/framework/store/src/extension/selection/selection-extension.ts index b6f795fa94..81338f6c5e 100644 --- a/blocksuite/framework/store/src/extension/selection/selection-extension.ts +++ b/blocksuite/framework/store/src/extension/selection/selection-extension.ts @@ -59,15 +59,6 @@ export class StoreSelectionExtension extends StoreExtension { const all = change.updated.concat(change.added).concat(change.removed); const localClientID = this.store.awarenessStore.awareness.clientID; const exceptLocal = all.filter(id => id !== localClientID); - const hasLocal = all.includes(localClientID); - if (hasLocal) { - const localSelectionJson = - this.store.awarenessStore.getLocalSelection(this._id); - const localSelection = localSelectionJson.map(json => { - return this._jsonToSelection(json); - }); - this._selections.value = localSelection; - } // Only consider remote selections from other clients if (exceptLocal.length > 0) { @@ -162,6 +153,7 @@ export class StoreSelectionExtension extends StoreExtension { this._id, selections.map(s => s.toJSON()) ); + this._selections.value = selections; this.slots.changed.next(selections); } diff --git a/tests/affine-local/e2e/peek-view.spec.ts b/tests/affine-local/e2e/peek-view.spec.ts index 440ddbf26e..e39657eca8 100644 --- a/tests/affine-local/e2e/peek-view.spec.ts +++ b/tests/affine-local/e2e/peek-view.spec.ts @@ -132,6 +132,7 @@ test('can open peek view for embedded frames', async ({ page }) => { const peekView = page.locator('[data-testid="peek-view-modal"]'); await expect(surfaceRef).toBeVisible(); + await surfaceRef.click(); await surfaceRef.hover(); await page .locator('affine-toolbar-widget editor-menu-button[aria-label="Open"]')