fix(core): fix stuttering when change doc title (#6269)

This commit is contained in:
EYHN
2024-03-22 10:06:37 +00:00
parent 69cb8b0f60
commit a0b97f948c

View File

@@ -1,4 +1,5 @@
import { Observable } from 'rxjs';
import { isEqual } from 'lodash-es';
import { distinctUntilChanged, map, Observable } from 'rxjs';
import { LiveData } from '../livedata';
import {
@@ -15,12 +16,10 @@ export class PageRecordList {
) {}
public readonly records = LiveData.from<PageRecord[]>(
new Observable(subscriber => {
new Observable<string[]>(subscriber => {
const emit = () => {
subscriber.next(
this.workspace.docCollection.meta.docMetas.map(
v => new PageRecord(v.id, this.workspace, this.localState)
)
this.workspace.docCollection.meta.docMetas.map(v => v.id)
);
};
@@ -31,7 +30,12 @@ export class PageRecordList {
return () => {
dispose();
};
}),
}).pipe(
distinctUntilChanged((p, c) => isEqual(p, c)),
map(ids =>
ids.map(id => new PageRecord(id, this.workspace, this.localState))
)
),
[]
);