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): not sync selection from awareness (#11420)

Saul-Mirone773db7860a24
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"]')