Hi all, I have an reactive application using DataAction to check condition show or hide an icon in menu, I need to check everytime I made any change in the screen. I'm using OnAfterFetch in DataAction and it worked, but It show warning about infinte loop if I use it.
Do you know how can I do the logic without OnAfterFetch or how can remove this warning?
You should rather refresh the data action when you are clearing the records or when you are closing your popup instead of refreshing it in its OnAfterFetch action then it may work.
If the problem persists, share an oml file to look into your code.
Thanks
Anees
Sorry for not clear issue description. I refresh DataAction in OnAfterFetch itself and it made out of memory server.
I removed refresh DataAction and moved it to ClosePopup action to prevent the infinite loop, it's worked now.
Thank you all for your solution.
Hello
Cause: The OnAfterFetch action of an Aggregate or Data Action runs right after it finishes fetching data. If you refresh the Aggregate or Data Action inside its own OnAfterFetch action, it will start fetching data again and run the OnAfterFetch action afterwards, causing an infinite loop.
You dint need to refresh the aggregate on after fetch of its own,
Use block OnParameterChange event and inside the OnParameterChange action refresh the data action.
But I recommend you to check role using Check Role API, because, you are going to hit server again and again on every call, This can lead to performance issue.
Links that you can follow to make it client side -
https://success.outsystems.com/documentation/11/reference/outsystems_apis/javascript_api/role_check/
https://www.outsystems.com/forums/discussion/53676/check-role-in-client-action/
https://www.outsystems.com/forums/discussion/81477/check-role-from-client-action-in-reactive-web-app/
I hope this helpsThanks
Tousif Khan
Yes, I have refresh DataAction in OnAfterFetch action to refresh data after I change anything in screen
As the screenshot I have I Check icon in menu, when I click on it a popup with list record is showed, If I clear all record of popup the icon will be hidden. That's why I use refresh DataAction.
If I remove DataAction refresh or OnAfterFetch it didn't work as expected, the icon hide or show only when I go to other screen, not current screen.
Can you please share your Oml, So that I can see what you are really tring there and what is the logic out there.
Are you having any action which is bind to the checkbox?
Hey bella,
Seems like you are refreshing the data action in its own OnAfterFetch event which is not a best practice also not required.
To overcome this warning just remove the refresh data action from the OnAfterFetch action of your data action.
Ideally there is no need to refresh any data action or aggregate in its own OnAfterFetch event.
Here whats happening is you are re-triggering the data action every time it fetches result, which becomes an infinite loop.
Hope you understand.
Hi,
Can you share the problem that you are trying to solve?
So that people can have an overall view of the problem and give more accurate solutions.I believe this is the problem that arises when you are implementing your solution.
I have read your reply and I can't see any relation between check role data action and displaying the checkbox for opening pop_up. Can you explain more?
You want to display the icon base on the record list. Why don't you enclose it with If Clause in the canvas? Does the data of the list be fetched in the Menu Block or other blocks or screen?
Cheers, Nam