Skip to content

Commit

Permalink
fix(edgeless): remove deps to theme provider in connector manager
Browse files Browse the repository at this point in the history
  • Loading branch information
doodlewind committed Dec 19, 2024
1 parent 8ae61d6 commit 6499c87
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/affine/block-surface/src/managers/connector-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
GroupElementModel,
type LocalConnectorElementModel,
} from '@blocksuite/affine-model';
import { ThemeProvider } from '@blocksuite/affine-shared/services';
import {
almostEqual,
assertEquals,
Expand All @@ -32,7 +31,6 @@ import {
toRadian,
Vec,
} from '@blocksuite/global/utils';
import { effect } from '@preact/signals-core';

import { Overlay } from '../renderer/overlay.js';
import { AStarRunner } from '../utils/a-star.js';
Expand Down Expand Up @@ -855,11 +853,16 @@ export class ConnectionOverlay extends Overlay {
}

private _setupThemeListener(): void {
const themeService = this.gfx.std.get(ThemeProvider);
this._themeDisposer = effect(() => {
themeService.theme$;
const observer = new MutationObserver(() => {
this._emphasisColor = this._getEmphasisColor();
});

observer.observe(this.gfx.std.host, {
attributes: true,
attributeFilter: ['style', 'class'],
});

this._themeDisposer = () => observer.disconnect();
}

_clearRect() {
Expand Down

0 comments on commit 6499c87

Please sign in to comment.