FIX: Reset preProcessorStatus state correctly for composer-upload-uppy (#14111)

When resetting the preprocessor status states, we weren't using
the same default state as when the preprocessor status state is
first initialized with an associated plugin. This commit brings
the two into alignment, fixing a bug where if you cancelled an
upload then tried a new one the "Processing Upload" message would
never change to "Uploading... X", so any subsequent uploads were
uncancellable.

Since the state was not being reset correctly, the properties that
were supposed to be numbers ended up as `undefined`, so when calling
prop-- or prop++, they turned into NaN.
This commit is contained in:
Martin Brennan 2021-08-23 13:50:37 +10:00 committed by GitHub
parent 3ac3a4b55e
commit 4dc93a53e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -352,7 +352,12 @@ export default Mixin.create({
isCancellable: false,
});
this._eachPreProcessor((pluginClass) => {
this._preProcessorStatus[pluginClass] = {};
this._preProcessorStatus[pluginClass] = {
needProcessing: 0,
activeProcessing: 0,
completeProcessing: 0,
allComplete: false,
};
});
this.fileInputEl.value = "";
},