Skip to content

Commit d845cdd

Browse files
authored
fix(storage): unsubscribing from the upload progress will not cancel and added replay (#2688)
* unsubscribing from upload progress shouldn't cancel the upload, that was undefined behavior IMO * `shareReplay` the upload, so one could pick back up (say if they had upload progress `| async` on a view somewhere) Closes #2685
1 parent 1530112 commit d845cdd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/storage/observable/fromTask.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Observable } from 'rxjs';
2+
import { shareReplay } from 'rxjs/operators';
23
import { UploadTask, UploadTaskSnapshot } from '../interfaces';
34

45
export function fromTask(task: UploadTask) {
@@ -13,6 +14,7 @@ export function fromTask(task: UploadTask) {
1314
progress(task.snapshot);
1415
complete();
1516
});
16-
return () => task.cancel();
17-
});
17+
}).pipe(
18+
shareReplay({ bufferSize: 1, refCount: false })
19+
);
1820
}

0 commit comments

Comments
 (0)