feat(editor): replace slot with rxjs subject (#10768)

This commit is contained in:
Mirone
2025-03-12 11:29:24 +09:00
committed by GitHub
parent 19f978d9aa
commit cd63e0ed8b
302 changed files with 1405 additions and 1251 deletions

View File

@@ -355,7 +355,10 @@ describe('stash/pop', () => {
elementModel.stash('strokeWidth');
const onchange = vi.fn();
model.elementUpdated.once(({ id }) => onchange(id));
const subscription = model.elementUpdated.subscribe(({ id }) => {
subscription.unsubscribe();
onchange(id);
});
elementModel.strokeWidth = 10;
expect(onchange).toHaveBeenCalledWith(id);
@@ -449,7 +452,10 @@ describe('local decorator', () => {
const onchange = vi.fn();
model.elementUpdated.once(({ id }) => onchange(id));
const subscription = model.elementUpdated.subscribe(({ id }) => {
subscription.unsubscribe();
onchange(id);
});
elementModel.display = false;
expect(elementModel.display).toBe(false);

View File

@@ -159,7 +159,7 @@ export class TestAffineEditorContainer extends SignalWatcher(
super.connectedCallback();
this._disposables.add(
this.doc.slots.rootAdded.on(() => this.requestUpdate())
this.doc.slots.rootAdded.subscribe(() => this.requestUpdate())
);
}