In my quest to maximize the difference between Reactive & Traditional Web Apps, I wish to know if I'm right about something:
The Preparation of a Screen in a Traditional Web App is exactly the same as, collectively,
the OnInitialize of a Screen in a Reactive Web App.
It is not quite the same.
Preparation, a dedicated server-side Action that loads initial data for Screens, does not exist in the client-side Reactive interface. The absence of this Action points to one of the most significant differences you need to take care of: optimize which data is fetched by the front-end. We provide some guidelines in the section on how to migrate Preparation.
In case of OnInitialize, will be executed asynchronously. So it will arrive sometime after the screen is rendered.
Since you need that execution to change the css of widgets in the page I would advice you to get those colors from local storage (from the device) by doing a synchronization (beforehand) with the server to get that data.
Then in the OnInitialize you compute the color from data in local storage. It's not an optimal solution but at least you will be fetching data from the device and you will not see flickering of the widgets when the style arrives from the execution of the Data Action.
You can check this document: Notable differences between Traditional and Reactive
I hope this help you.Cheers
Nuno Miguel Verdasca wrote:
Based on what you've shown me I want to summarize with you my understanding:
The Preparation can be exactly emulated, in Reactive Web, via the use of Aggregates and Data Actions.
Correct?
Hi Olivier,
No, the Preparation is equal to screen data fetching with using OnAfterFetch if needed and data fetching from another source.
Daryna Kravets wrote:
I didn't understand you - did you mean that the Preparation's equivalent in Reactive Web Apps is OnAfterFetch?
Olivier Levine wrote:
No. In Preparation you can fetch data and do something with it. In Reactive you fetches data asynchronously on screen and then you can do something with fetched data in OnAfterFetch action. Preparation's equivalent in Reactive Web Apps isn't one action.
So - because there's no synchronous Event Handler for Reactive Web Screens - the Preparation cannot be emulated?
If you want to emulate the Preparation exactly, use Fetch Data from Other Sources way to fetching and make aggregates and other things inside this action.
But fetching this way can make your app slowly.
Hi Daryna Kravets,
Adding to the above mentioned comments, refer the below pointers for more understanding.
Traditional Web Application
Reactive Web Application
Hope this helps you!
Regards,
Benjith Sam