Hi everyone,
I am currently working on some client/server side validations, and noticed that the Client/Server separation often requires a duplication of code (validations in client side and validations in server side). Because of this, I thought of the idea of potentially having some "Flexible", "Elementary" or "Basic" Action types that could be reused on both Client and Server Actions, considering that OutSystems uses its own set of basic data types that are shared between client and server side logic.
The constraint of these types of actions would be:
- When they are called within a Client Action, they run as Client Action (client-side logic, runs in the browser); when they are called within a Server Action, they run as a Server Action (server-side logic, runs in the server).
- They cannot contain calls to Client or Server Actions. They can only call other "Flexible" actions in their flow and basic operations that are already available both in Client/Server Actions, such as: If, Assign, For Each, etc.
- They would generally be used for primitive operations: basic arithmetic and logic operators, and built in List-related actions, restricting any functionality that might make the "Flexible" behavior technically impossible.
I understand that Server Actions can be used normally within Client Actions, however (as far as I am aware), they require a server call and therefore cannot be used as validations that run exclusively in the browser.
In general, these could be useful wherever a shared foundation codebase between client-side and server-side logic would be useful, such that it could also be extended on both sides independently. The first scenario I can think about is client and server side validations, but I am sure there are similar scenarios where such a functionality would be useful to avoid code duplication.