Lightning Events: why force:refreshView is fired 4 times when a record is updated via standard Record Detail on Flexipage?

I need to detect record-updates by different sources as stated here: Lightning Components: how to use events to detect record updates?

For this example, I’m using the standard Record Detail compo on a Flexipage.

I don’t like it, but unfortunately the only viable approach seems to handle the force:refreshView seem to be the only way to detect updates. I handle them like like that:


<aura:handler event="force:refreshView" action="{!}" />


events : function(cmp, evt, hlp){


Now ‘HANDLER’ appears exactly 4 times in my console per subscribing component I have on the Flexipage. Why that?


Each handler should get called once per subscribing component.


Only workaround I found so far is building a throttle

<aura:attribute name="refreshTimestamp" type="Integer" default="0" />

forceRefreshViewHandler : function(cmp, evt, hlp){
    var lastRefresh             = cmp.get("v.refreshTimestamp")
    if( hlp.ts() - lastRefresh > 1000 ) {
        // doing my stuff here
        cmp.set("v.refreshTimestamp" , hlp.ts() );

The standard component is hammering usually it’s 4 bullets within less than 50ms so it seems to work. But hackish as hell and still no explanation why it’s necessary at all.

Source : Link , Question Author : Uwe Heim , Answer Author : Uwe Heim

Leave a Comment