Need to LoadAsync with a delay in an EditForm

Hi,


When I want to use LoadAsync in an EditForm I need to give a delay to make it work.

I've also noticed that the new method "RefreshAsync" also needs a delay in some cases.


I can understand the reasons behind this behavior, but as end users we don't want to guess where we need to put a delay and how much delay is required, that's not convenient and it can take a lot of time to find this workaround.

Can you consider to make a fix so we never have to put some delay ?


Please see this sample : https://blazorplayground.syncfusion.com/rZLgsDDfrfAVSibt


Regards,

Julien


3 Replies 1 reply marked as answer

KV Keerthikaran Venkatachalam Syncfusion Team November 2, 2023 04:53 PM UTC

Hi Julien Barach,


We have checked your reported query and identified that the issue arises when the page reloads after form submission, causing only the Signature component to render. The root cause of this problem is the page reload. To address this issue, we recommend using the "Created" event of the Signature component to load the signature. Please refer to the below code snippet.


<SfSignature Created="Created" @ref="Signature" style="height:300px;width:100%;" />

….

private async void Created()

 {

     if (customer.IsChecked)

     {

         await LoadSignature();

     }

 }



Please let us know if you need any further assistance on this.


Regards,

KeerthiKaran K V


Marked as answer

JB Julien Barach November 3, 2023 06:46 AM UTC

Hi,


With "page reload" you mean StateHasChanged ?

Because indeed, if I trigger a StateHasChanged the signature disappears the same way as I submit an EditForm.


Your workaround is working. It feels a bit weird that we have to do that but it's better than adding a delay.


Thanks.



KV Keerthikaran Venkatachalam Syncfusion Team November 3, 2023 04:05 PM UTC

Hi Julien Barach,


The Signature component will reinitialize itself after form submission, so only the signature will be removed. You can use the previously provided solution.


Please let us know if you need any further assistance on this.


Regards,

KeerthiKaran K V


Loader.
Up arrow icon