OnParametersSetAsync() and other life-cycle are being called several time.
Hi,
Does anyone ever noticed and/or reported to you that when certain razor component is created and placed some Syncfusion component
namely Dialog, then the component has at least one Parameter being passed into the razor component, the life-cycle
method OnParametersSetAsync() (or OnParametersSet() and actually same as other life-cycle methods) is being called several times when the dialog is called with .show()? Like in my case 7 times, on dialog show
runs 5 times. I'm beginning to question because I already asked this to Blazor in Github but they seem not convinced
with my findings. So I assume since I use your Blazor components, this might be a good candidate to ask your side?
I asked this because actually I do have a function that is called when a parameter is passed, thus calling the OnParametersSetAsync(). Inside it has a function to save record
so I noticed it saved several records. Can you please check if this is really an issue?
Thank you very much and more powers!
Thanks,
SIGN IN To post a reply.
3 Replies
J
j
February 13, 2020 04:42 AM UTC
On top of that, in using EjsDialog with EjsTab, clicking another tab and clicking back from the tab you came from will re-run the life cycle again. So it will erase all inputted text in there inside EjsTextbox and you have to input them again. Isn't that it should retain the information already placed in there? Actually this happens not just the two mentioned components but some as well.
Thank you.
IS
Indrajith Srinivasan
Syncfusion Team
February 13, 2020 12:42 PM UTC
Hi,
Greetings from Syncfusion support,
We are currently validating your reported query and will update further details in two business days (February 17th, 2020). Up until then, we appreciate your patience.
Regards,
Indrajith
IS
Indrajith Srinivasan
Syncfusion Team
February 17, 2020 12:46 PM UTC
Hi,
Greetings from Syncfusion support,
Query 1: “OnParametersSetAsync() (or OnParametersSet() and actually same as other life-cycle methods) is being called several times”
We have validated your reported query. This is behavior with the Blazor lifecycles since for each parameter changes in the component, it will be called. This occurs not only for Dialog control, it is called several times for the native Blazor component also.
Blazor Documentation: https://docs.microsoft.com/en-us/aspnet/core/blazor/lifecycle?view=aspnetcore-3.1#after-parameters-are-set
Github query: https://github.com/dotnet/aspnetcore/issues/18382
Query 2: “Isn't that it should retain the information already placed in there?”
As you said, the tab will be refreshed and the component will be re-rendered. To maintaining the previous values, you can store the value of the textbox in a variable and update it whenever there is changes in the Textbox thus when switching the tabs, the old value will be maintained. We have also prepared a sample based on your requirement.
Regards,
Indrajith
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
J j
- Feb 12, 2020 08:06 AM UTC
- Feb 17, 2020 12:46 PM UTC