0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fixed "calling .set on destroyed object" error in gh-image-uploader tests

refs https://github.com/TryGhost/Admin/pull/2041

- the pretender upgrade highlighted an issue with the component's progress event handler where it could fire and attempt to set the progress property after the component has been destroyed
This commit is contained in:
Kevin Ansfield 2022-01-06 10:05:15 +00:00
parent 1bdb545ef7
commit 73a6354135

View file

@ -204,7 +204,9 @@ export default Component.extend({
if (event.lengthComputable) {
run(() => {
let percentage = Math.round((event.loaded / event.total) * 100);
this.set('uploadPercentage', percentage);
if (!this.isDestroyed && !this.isDestroying) {
this.set('uploadPercentage', percentage);
}
});
}
},