mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 17:46:18 +08:00
feat(editor): add blobState$ to BlobEngine (#11756)
Closes: [BS-3137](https://linear.app/affine-design/issue/BS-3137/在-bs-添加-blobstate-接口) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced real-time status tracking for file upload and download operations, allowing users to monitor progress and errors more effectively. - **Improvements** - Enhanced icon display for attachments, providing a refreshed visual experience. - Improved update frequency and accuracy for file synchronization status indicators. - **Bug Fixes** - Refined internal logic for filtering status updates, ensuring more precise feedback during file operations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -97,7 +97,7 @@ export class BlobSyncImpl implements BlobSync {
|
||||
return combineLatest(
|
||||
this.peers.map(peer => peer.blobPeerState$(blobId))
|
||||
).pipe(
|
||||
throttleTime(1000),
|
||||
throttleTime(1000, undefined, { leading: true, trailing: true }),
|
||||
map(
|
||||
peers =>
|
||||
({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { difference } from 'lodash-es';
|
||||
import { Observable, ReplaySubject, share, Subject } from 'rxjs';
|
||||
import { filter, Observable, ReplaySubject, share, Subject } from 'rxjs';
|
||||
|
||||
import type { BlobRecord, BlobStorage } from '../../storage';
|
||||
import { OverCapacityError, OverSizeError } from '../../storage';
|
||||
@@ -412,11 +412,13 @@ class BlobSyncPeerStatus {
|
||||
});
|
||||
};
|
||||
next();
|
||||
const dispose = this.statusUpdatedSubject$.subscribe(updatedBlobId => {
|
||||
if (updatedBlobId === blobId || updatedBlobId === true) {
|
||||
next();
|
||||
}
|
||||
});
|
||||
const dispose = this.statusUpdatedSubject$
|
||||
.pipe(
|
||||
filter(
|
||||
updatedBlobId => updatedBlobId === blobId || updatedBlobId === true
|
||||
)
|
||||
)
|
||||
.subscribe(() => next());
|
||||
return () => {
|
||||
dispose.unsubscribe();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user