A way to refresh, at will, a reactive Screen/Block
3303
Views
13
Comments
New
Frontend (App Interfaces)

It is known that any Screen/Block in Outsystems Reactive can only be refreshed (when already instantiated) if an input parameter is changed of that Screen/Block. 


What about having a property in each Input parameter, saying:


Reassigned to the same value will trigger On Parameter Change


Hence, we could detect if any parameter is reassigned to the same value, and if it has that property set to 'Yes', the Screen/Block would trigger an On Parameter Change.

Why would you want to render the block screen or block again if no inputs have changed?

Changed the category to
Frontend

@Daniël Kuhlmann because there was a change in the data. It's quite typical to have the block with a query for displaying the data, but if the data has changed, e.g. in some other part of the screen, the block must be refreshed. See e.g. here and here.

We have a case where we need to update backend data on the web block (this is one of our core components used by many applications), then the application reusing the block also needs to do an update.  The data on the parent block only changes in certain cases though.  We need to be able to reload the block to reflect changes in both instances.

I need to refresh a chatbox and to do so I'm playing with duplicated parameters, event and double refresh to make it work. This event is really necessary...

Merged this idea with 'Refresh Block Action' (created on 24 Feb 2023 04:56:25 by BabyBear)

Hi

Currently for us to refresh aggregates/dataaction we use the on parameter change event. I think It would be helpful if there is an Action for us to reinitialize a block. It can be a client action that accepts the Id of the block and it should re initialize it,

Agree that it would be nice if the platform provides this, liked your idea.

But as a workaround,  with some javascript, you could brew your own version of this.  

It is a matter of

  • uniquely identifying the block to be refreshed (think about block instances in a list)
  • exposing that blocks refresh action to some more global scope
  • triggering that blocks refesh action in that more global scope

This is not a new idea, incidentally, maybe also go upvote this one

see also this documentation for a possible implementation

Thank you Dorine. I did upvote the Idea you linked.

I just ran into the same issue, I have a block that displays DB data that is changed in the screen actions (file history) that is not bound to any input parameter. 

So if we had a native way to force the block to reaload, it would be much easier and cleaner than having a dummy input that we manipulate in order to trigger the onParametersChanged event.

Having the same issue! Using a dummy input parameter to trigger it, but its not the most elegant and the problem is that this parameter isn't used anywhere inside the web block so its highlighted as unused and potentially a new dev can mistake it for a non-important parameter and delete it. 

Facing same issue. Need to refresh block from parent screen because block content a aggregate which will get different data if some changes happen in the parent screen. we are using dummy input parameter for now to refresh the block.

If we can just simply trigger some event like we can do in traditional app then it will be great.