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.

Hi Olivier,

No, the Preparation is equal to screen data fetching with using OnAfterFetch if needed and data fetching from another source.

Solution

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


Solution

Daryna Kravets wrote:

Hi Olivier,

No, the Preparation is equal to screen data fetching with using OnAfterFetch if needed and data fetching from another source.

I didn't understand you - did you mean that the Preparation's equivalent in Reactive Web Apps is OnAfterFetch?


Olivier Levine wrote:

Daryna Kravets wrote:

Hi Olivier,

No, the Preparation is equal to screen data fetching with using OnAfterFetch if needed and data fetching from another source.

I didn't understand you - did you mean that the Preparation's equivalent in Reactive Web Apps is OnAfterFetch?


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.

Nuno Miguel Verdasca wrote:

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


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?

Daryna Kravets wrote:

Olivier Levine wrote:

Daryna Kravets wrote:

Hi Olivier,

No, the Preparation is equal to screen data fetching with using OnAfterFetch if needed and data fetching from another source.

I didn't understand you - did you mean that the Preparation's equivalent in Reactive Web Apps is OnAfterFetch?


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

  • Preparation is a special kind of Server Action of which the action flow occurs/executes at SERVER side, BEFORE the page is built and sent back to the browser.
  • The activities like value calculation, value assignments, fetching data from some external source like services or DB table using aggregate or SQL Query etc... which we need to be performed before the screen starts rendering (or which is needed for screen rendering) such pre-execution logics are defined in the Preparation server action flow.

Reactive Web Application

  • On Initialize event handler – Occurs before the screen DOM is loaded and it occurs/gets executed at CLIENT side. You can use this event handler to implement all the logic that doesn’t require the DOM, such as to initialize some default data.
  • The execution of the action flow is asynchronous
    • This action will run before navigating to this Screen and rendering it.
      Do:
      - initialize local variables;
      - any changes that do not involve the Screen’s DOM.

      Don’t:
      - use server calls;
      - perform local storage operations.

Hope this helps you!


Regards,

Benjith Sam