Closed yuliankarapetkov closed 3 years ago
@yuliankarapetkov Can you create a stackblitz for me to debug?
@davideast Hey, thanks for looking into this for me.
Here's a stackblitz link
UPDATE: Just noticed that state doesn't change at all, even if the upload has actually been successful. However, the snapshot embedded task object has the correct state, so I guess that this is really a bug.
See screenshot: https://imgur.com/HixmZ2T
@davideast did you get the chance to check the stackblitz link provided?
Seems to be a real bug The last event is not emitted on the snapshotChanges() however it will be emitted in the .then() promise
this._task.snapshotChanges()
.subscribe(snapshot => {
this.snapshot = snapshot; // To get updates on progress
});
this._task.then(snapshot => {
this.snapshot = snapshot; // To know when it is done
}).catch(snapshot => {
this.snapshot = this._task.task.snapshot; // To know whenever there is an error/cancel from user
});
Both of these issues should have been addressed in a recent 6.0 patch, we were not updating the taskSnapshot on completion just completing the observable. Similarly I realized error wasn't updating the snapshot and have made a PR for that #2665 which will be in 6.1.1
Version info
Angular: 6.03
Firebase: 5.2.0
AngularFire: 5.0.0-rc.11
How to reproduce these conditions
Steps to set up and reproduce
Subscribe to
snapshotChanges
and log the value of the snapshot. Cancel theAngularFireUploadTask
through thecancel()
method. Snapshot doesn't change =>snapshot.state === 'running'
, instead ofsnapshot.state === 'cancelled'
Expected behavior
snapshot
has a new value withstate === 'cancelled'
Actual behavior
snapshot
doesn't have a new value, sostate === 'running'