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.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(editor): lit change-in-update warning (#11904)
L-Sun020c1a75984e
diff --git a/blocksuite/affine/widgets/edgeless-auto-connect/src/index.ts b/blocksuite/affine/widgets/edgeless-auto-connect/src/index.tsindex 364630c15b..ee5f840c2f 100644--- a/blocksuite/affine/widgets/edgeless-auto-connect/src/index.ts+++ b/blocksuite/affine/widgets/edgeless-auto-connect/src/index.ts@@ -288,8 +288,7 @@ export class EdgelessAutoConnectWidget extends WidgetComponent<RootBlockModel> {if (!this.block) {return;}- const { service } = this.block;- const surfaceRefs = service.doc+ const surfaceRefs = this.block.std.store.getBlocksByFlavour('affine:surface-ref').map(block => block.model) as SurfaceRefBlockModel[];diff --git a/blocksuite/affine/widgets/remote-selection/src/doc/doc-remote-selection.ts b/blocksuite/affine/widgets/remote-selection/src/doc/doc-remote-selection.tsindex 1591b27901..b008735eb6 100644--- a/blocksuite/affine/widgets/remote-selection/src/doc/doc-remote-selection.ts+++ b/blocksuite/affine/widgets/remote-selection/src/doc/doc-remote-selection.ts@@ -17,7 +17,7 @@ import {import { GfxControllerIdentifier } from '@blocksuite/std/gfx';import type { BaseSelection, UserInfo } from '@blocksuite/store';import { computed, effect } from '@preact/signals-core';-import { css, html, nothing, type PropertyValues } from 'lit';+import { css, html, nothing } from 'lit';import { state } from 'lit/decorators.js';import { styleMap } from 'lit/directives/style-map.js';import throttle from 'lodash-es/throttle';@@ -269,6 +269,32 @@ export class AffineDocRemoteSelectionWidget extends WidgetComponent {});this._remoteColorManager = new RemoteColorManager(this.std);++ this.disposables.add(+ effect(() => {+ const selections = this._remoteSelections.value;+ this._updateSelectionsThrottled(selections);+ })+ );+ this.disposables.add(+ this.std.store.slots.blockUpdated.subscribe(() => {+ this._updateSelectionsThrottled(this._remoteSelections.peek());+ })+ );+ const gfx = this.std.get(GfxControllerIdentifier);+ this.disposables.add(+ gfx.viewport.viewportUpdated.subscribe(() => {+ const selections = this._remoteSelections.peek();+ this._updateSelections(selections);+ })+ );+ this.disposables.add(+ this.std.event.active$.subscribe(value => {+ if (!value) {+ this.std.selection.clearRemote();+ }+ })+ );}override disconnectedCallback() {@@ -302,37 +328,6 @@ export class AffineDocRemoteSelectionWidget extends WidgetComponent {60);- protected override firstUpdated(_changedProperties: PropertyValues): void {- this.disposables.add(- effect(() => {- const selections = this._remoteSelections.value;- this._updateSelectionsThrottled(selections);- })- );-- this.disposables.add(- this.std.store.slots.blockUpdated.subscribe(() => {- this._updateSelectionsThrottled(this._remoteSelections.peek());- })- );-- const gfx = this.std.get(GfxControllerIdentifier);- this.disposables.add(- gfx.viewport.viewportUpdated.subscribe(() => {- const selections = this._remoteSelections.peek();- this._updateSelections(selections);- })- );-- this.disposables.add(- this.std.event.active$.subscribe(value => {- if (!value) {- this.std.selection.clearRemote();- }- })- );- }-override render() {if (this._selections.length === 0) {return nothing;diff --git a/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts b/packages/frontend/core/src/blocksuite/ai/chat-panel/index.tsindex ce1f2623fa..f9e59769e0 100644--- a/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts+++ b/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts@@ -259,14 +259,16 @@ export class ChatPanel extends SignalWatcher(this.embeddingProgress = [0, 0];};- protected override updated(_changedProperties: PropertyValues) {+ protected override willUpdate(_changedProperties: PropertyValues) {if (_changedProperties.has('doc')) {this._resetPanel();requestAnimationFrame(async () => {await this._initPanel();});}+ }+ protected override updated(_changedProperties: PropertyValues) {if (this.chatContextValue.status === 'loading') {// reset the wheel triggered flag when the status is loadingthis._wheelTriggered = false;diff --git a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-composer/ai-chat-composer.ts b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-composer/ai-chat-composer.tsindex 43f18be5f0..089accdc09 100644--- a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-composer/ai-chat-composer.ts+++ b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-composer/ai-chat-composer.ts@@ -156,7 +156,7 @@ export class AIChatComposer extends SignalWatcher();}- protected override updated(_changedProperties: PropertyValues) {+ protected override willUpdate(_changedProperties: PropertyValues) {if (_changedProperties.has('doc')) {this._resetComposer();requestAnimationFrame(async () => {