mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
fix(core): fix stuttering when change doc title (#6269)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { Observable } from 'rxjs';
|
import { isEqual } from 'lodash-es';
|
||||||
|
import { distinctUntilChanged, map, Observable } from 'rxjs';
|
||||||
|
|
||||||
import { LiveData } from '../livedata';
|
import { LiveData } from '../livedata';
|
||||||
import {
|
import {
|
||||||
@@ -15,12 +16,10 @@ export class PageRecordList {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
public readonly records = LiveData.from<PageRecord[]>(
|
public readonly records = LiveData.from<PageRecord[]>(
|
||||||
new Observable(subscriber => {
|
new Observable<string[]>(subscriber => {
|
||||||
const emit = () => {
|
const emit = () => {
|
||||||
subscriber.next(
|
subscriber.next(
|
||||||
this.workspace.docCollection.meta.docMetas.map(
|
this.workspace.docCollection.meta.docMetas.map(v => v.id)
|
||||||
v => new PageRecord(v.id, this.workspace, this.localState)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -31,7 +30,12 @@ export class PageRecordList {
|
|||||||
return () => {
|
return () => {
|
||||||
dispose();
|
dispose();
|
||||||
};
|
};
|
||||||
}),
|
}).pipe(
|
||||||
|
distinctUntilChanged((p, c) => isEqual(p, c)),
|
||||||
|
map(ids =>
|
||||||
|
ids.map(id => new PageRecord(id, this.workspace, this.localState))
|
||||||
|
)
|
||||||
|
),
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user