+ Start a Discussion
Siddharth LakhotiaSiddharth Lakhotia 

Page Refresh not happening in lightning after click of button

Hi,

When I click on custom button  "Accept Ownerhsip" , it should change owner. 

Though the owner gets changed , but it gets refelted only after page is refreshed manually.

The logic of ownership change is implemented in Apex 
Khan AnasKhan Anas (Salesforce Developers) 
Hi Siddharth,

Greetings to you!

Currently, there is a known issue in lightning that prevents reflection of data updates on UI.

https://success.salesforce.com/issues_view?id=a1p3A0000001C8QQAU&title=data-not-updated-in-ui-after-an-apex-update-in-lightning-experience

However, you can use force:refreshView to force all data to reload.

Try like this:
clientMethod : function(component,event,helper) {
        var action = component.get("c.serverMethod");   //calling server-side method
        action.setParams({
        	"serverParameter":clientParameter
    	});
        action.setCallback(this, function(response){
            var state = response.getState();
            if(state === 'SUCCESS'){
                $A.get('e.force:refreshView').fire();
            }
            ...
            ...
            ...
        )};
        $A.enqueueAction(action);
},

/*page refresh after data save*/
    
    isRefreshed: function(component, event, helper) {
        location.reload();
    },

And don't forget to add below handler in your component:
<aura:handler event="force:refreshView" action="{!c.isRefreshed}" />

Also, please make sure to turn off browser caching in your Org.

From Setup, locate the link to ‘Session Settings’.
Locate the ‘Caching’ section.
Uncheck the option to ‘Enable secure and persistent browser caching to improve performance’.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Siddharth LakhotiaSiddharth Lakhotia
Tried doing that.. Data does not get changed.. Same error persists.. How do i refresh the data