52
Views
10
Comments
Solved
App freezing due to inputs changing during OnParametersChanged
Question
Application Type
Reactive

My app is freezing for a period of time when using a web block I built. It then resumes as normal. I assume it is the JS blocking somehow but I am not sure.

What is happening is as follows:
1. The input parameters for the web block in question are changing since I am changing something in the main screen - a text input into which I am typing

2. In the OnParametersChanged of the web block, if a particular input changes then, I am triggering an event

3. This event is handled on the main screen and changes some of the input parameters for the web bock - but in a way that the web block will not again run the event since the parameter that triggers the event is not changed on the second time arounf.

4. End of flow

Seems like it should be fine. However, each time I type a new letter the freeze period is longer and longer. What am I missing here?

(There is some JS on the InputMask React Forge Asset that I am using which could be causing something to go wrong but again, not sure how).

I have tried to track the performance of the app in the Google Dev tools but it is not giving anything useful and is painfully slow - probably because of how much JS is running - since I assume this is causing the blocking.


I can't upload the OML.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution

Hi, I removed both InputMaskReactFlow\MaskCurrency widgets, and then the issues seems to disappear and your screen and block behave as expected. The MaskCurrency widget has a lot of javascript. I don't have time to dive into that. But that is where you can focus your further analyse on.


2024-04-05 11-04-57
Krishnnambal
 
MVP

Hi,

It will be helpful if you can share the oml.

2022-11-02 07-18-33
Nicholas Campbell

Hi Krishnnambal 

I added some extra clarity to the question. Perhaps that will help?

2022-08-03 04-32-50
Ravi Punjwani

Hi Nicholas,

  1. Do you have more than one input parameter in this web block? If yes, make sure you have a condition check inside your OnParametersChanged to confirm that the code executes only for a change in  specific parameter only, and not for any input parameters. This doesn't apply if you've only 1 input parameter in your web block.

  2. Do you trigger event on each change in this relevant parameter?

    If yes, then why need an event and why need an OnParameterChanged? Just execute the event handler code from the parent block itself where you've this change happening. It might not be possible in some cases like a parent block's textbox variable directly being passed into this web block as input param. In this case you can call the event handler's code in your textbox's OnChange event.

    If no, then add another specific condition inside OnParameterChanged to make sure you only trigger the event when needed.

  3. Check InputMask React forge component. If it is adding any event handler on your HTML elements, you might need to make sure those handlers are removed inside OnDestroy so you don't end up in a huge memory leak. This can be checked in memory usage from Google Dev tools.

Let me know if these doesn't help, I'll might come up with some more suggestions using Google Dev tools. I see you can't share the app OML, but is it possible to replicate in a separate OML? Or possibly share your app's URL here (or personal message) so it can be checked on my browser.

2022-11-02 07-18-33
Nicholas Campbell

Hi Ravi

Thank you for the suggestions. Let me look into what you've said and if I don't come right I will isolate that code into a separate OML as you suggested.

2022-11-02 07-18-33
Nicholas Campbell

Hi Ravi

The suggestions have not worked for this particular situation. I will send a separate OML direct to you.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

If your block has multiple input parameters, it can fire multiple OnParameterChange events, if the OnParameterChange event has logic that computes anything more than a few hundred milliseconds it quickly built up to a slow user experience.

You could try a solution I proposed a few years back, it is described here:

https://www.outsystems.com/forums/discussion/64124/onparameterschanged-issue/

Regards,

Daniel

2022-11-02 07-18-33
Nicholas Campbell

Thanks Daniel

Thanks for the reply. I will have a look at that. I debugged and found that it was not running the OnParametersChanged multiple times even though in theory it should be - perhaps it is running it in the background but not showing in the debugger for some reason? If I debug, it runs the OnParametersChanged the first time, gets to the end and then once I pass the END node it freezes and then becomes normal again but does not run the OnParametersChanged again or any other action - I put a breakpoint on every action in the app and nothing was fired - unless there is JS on the InputMask Component running but I doubt it since I use that elsewhere and have never seen thus happen.

2022-11-02 07-18-33
Nicholas Campbell

@Daniël Kuhlmann I had a look at that post and it seems similar but what's different is that the OnParemetersChanged seems to only be running one in my case as I said in the above message. I logged a message to the Console each time it ran to see if maybe it was the debugger just missing the following runs of the OnParametersChanged but it only writes one message and after that freezes and then goes back to normal - so I have no idea what it is running during that freeze time.


I have separated the functionality into an OML that I can share. Please let me know what you find Daniel and @Ravi Punjwani.

I appreciate the assistance.

InputOrPercent.oml
2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution

Hi, I removed both InputMaskReactFlow\MaskCurrency widgets, and then the issues seems to disappear and your screen and block behave as expected. The MaskCurrency widget has a lot of javascript. I don't have time to dive into that. But that is where you can focus your further analyse on.


2022-11-02 07-18-33
Nicholas Campbell

Hi Daniel

That was a good idea to do, kicking myself for not trying to eliminate that possibility. Thanks for doing that.

That is a pity as that is a lot harder to fix than a silly issue on my side. But will have to look into it and will chat with the asset owner.

Thanks again.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.