openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

[Stylistic] Unnecessary error thrown while Creating UploadCollection with instantUpload = true

Open ANMichael opened this issue 8 years ago • 3 comments

https://github.com/SAP/openui5/blob/a5e2ae0913c3bfb196ea07de964757c61be91c89/src/sap.m/src/sap/m/UploadCollection.js#L33

https://github.com/SAP/openui5/blob/a5e2ae0913c3bfb196ea07de964757c61be91c89/src/sap.m/src/sap/m/UploadCollection.js#L35

https://github.com/SAP/openui5/blob/a5e2ae0913c3bfb196ea07de964757c61be91c89/src/sap.m/src/sap/m/UploadCollection.js#L41

https://github.com/SAP/openui5/blob/a5e2ae0913c3bfb196ea07de964757c61be91c89/src/sap.m/src/sap/m/UploadCollection.js#L524

OpenUI5 version: all versions >1.30 (since initial implementation of Upload Collection)

If a new UploadCollection is created and the propery instantUpload is set to true there is an error thrown, which is not at all an error.

In the beginning of the constructor of the UploadCollection the value instantUpload is removed from mSettings if it has the value false. If the value is true, it is not removed and thus will be proccessed during the Control.apply(this, arguments); command (a few lines below). This calls the method setInstantUpload which throws the following error: "It is not supported to change the behavior at runtime."

This error message is not correct, because the true value is set at the creation not at runtime. It has no affects on the function of the UploadCollection but is a stylistic error. I know that the instantUpload does not need to be set to true, because it is the default value, but if it happens there shouldn't be an error thrown.

ANMichael avatar Jan 18 '18 11:01 ANMichael

Hi @ANMichael ,

I have created internal ticket with number 1880079425 regarding this issue.

Kind regards, Gery

gerym avatar Jan 23 '18 15:01 gerym

Dear @ANMichael ,

Sorry for the delay in response.

The behavior and rendering of uploadCollection heavily depends on instantUpload property. Because of this we had recommended to set instantUpload property before the rendering or creation of uploadCollection control.

So for better stability of the control its not recommended to change the instandUpload property at runtime and so this exception was added.

But I agree to what you have said and scenario you have mentioned is valid. Thank you for pointing out regarding it.

I am working on fix for it.

I will keep post you the progress.

Regards, Dhanwin. SAP UI5 Suite Controls.

dhanwin89 avatar Aug 31 '18 08:08 dhanwin89

Dear @ANMichael ,

The issue you had reported has been fixed and fix is successfully merged.

The fix will be available in future releases from - sap ui5 rel - 1.61 onwards

Hence we have closed the incident.

Regards, Dhanwin. Suite Controls.

dhanwin89 avatar Dec 03 '18 05:12 dhanwin89