I created a custom action which is a lightning component to deactivate the current order and then redirect to the same page. The order is deactivated successfully but after redirecting, the order page still shows the old status until I refresh the page manually.
I have already disabled lightning experience caching but it still doesn't work very well.
Related Apex code:
relatedOrder.ActivatedById = null;
relatedOrder.ActivatedDate = null;
relatedOrder.Status = 'Draft';
update relatedOrder;
System.debug('Finished order update');
Order orderAfterUpdate = [Select Id, Status From Order Where Id = :relatedOrder.Id];
System.debug('After status is: ' + orderAfterUpdate.Status); //This status has no issue
Related JS code:
var navEvt = $A.get("e.force:navigateToSObject");
navEvt.setParams({
"recordId": orderId
});
navEvt.fire();