Skip to content

don't cancel the upload if you unsubscribe from AngularFireUploadTask.percentageChanges() #2685

Closed
@leon

Description

@leon

Version info

Angular:
11.

Firebase:
8.16.1

AngularFire:
6.1.1

Other (e.g. Ionic/Cordova, Node, browser, operating system):
Mac OS Big Sur

How to reproduce these conditions

Failing test unit, Stackblitz demonstrating the problem
har to show, since it needs access to a writable storage bucket.
But it's a "simple" problem.

Steps to set up and reproduce

upload a file using the AngularFireStorage
whilst uploading subscribe to the percentageChanges() observable
But half way through, unsubscribe from the percentageChanges() the upload will cancel.

Expected behavior

It doesn't feel right that subscribing/unsubscribing to a progress, should impact the upload itself.

The problem lies here
https://github.com/angular/angularfire/blob/master/src/storage/observable/fromTask.ts#L16

listening to stateChanges maybe should cancel the upload if you unsubscribe.

I might be wrong about this.
But I just encountered this problem, and I thought it would be good to inform you of this.
I could not find any documentation regarding canceling of uploads, so it might be a good time to be more upfront about how it works and which use cases we should support.

Actual behavior

unsubscribe from percentageChanges() will cause the upload to cancel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions