JS error when using the BeforeUpload event in a refreshed EditContext

Hi,


The SfUploader compoments fails to upload files by having a 'Cannot read properties of undinfed (reading 'classList')' error.


The following conditions make it occur :

  • Use the SfUploader in an EditForm
  • Use the BeforeUpload event (the place to manage the CurrentRequest since it doesn't work on the FileSelected event anymore)
  • Use the UploaderAsyncSettings SaveUrl property
  • Submit the EditForm data then init a new EditContext

The thing is that the SfUploader lose its state when the EditForm/EditContext is re-initialized.
By losing its state it cannot do all of its JS fancy things.
It should be resilient and continue to send the files like it does when the SaveUrl or the BeforeUpload are not used.


See repro (select a file then click submit) : https://blazorplayground.syncfusion.com/rNLojVCXftgkyiXS

Regards,
Julien

2 Replies 1 reply marked as answer

PK Priyanka Karthikeyan Syncfusion Team February 18, 2025 01:09 PM UTC

Hi Julien Barach,

 

We have considered this issue "Console error occurs on Uploader when the EditForm/EditContext is re-initialized in submit button" as a bug from our end, and the fix for the issue will be included in our upcoming weekly release which is expected to be scheduled at the end of February 2025.

 

You can now track the status of the feedback through the below link,

 

Feedback link:https://www.syncfusion.com/feedback/65543/console-error-occurs-on-uploader-when-the-editform-editcontext-is-re-initialized

 

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”

 

Regards,

Priyanka K



PK Priyanka Karthikeyan Syncfusion Team March 4, 2025 08:04 AM UTC

Hi Julien Barach,


We have included the fix for the issue “Console error occurs on Uploader when the EditForm/EditContext is re-initialized in submit button” with our package version “28.2.9”. Therefore, we recommend upgrading to our latest version to resolve the current issue. 

 

Sample: https://blazorplayground.syncfusion.com/BNBStKjJrFldfQgq

 

Rootcause:
The issue occurs when attempting to access a null value without first verifying whether the variable is null before reinitializing the uploader component.

 

Regards,

Priyanka K


Marked as answer
Loader.
Up arrow icon