After we update a record and navigate to a detail page, it still shows the old data.
Steps:
- Overridden
edit
button of Account with a Lightning component. - Also used a Visualforce page with lightning out to host the component as an override, but still have same issue.
Note: Navigation issue is in 2 places:
- Lightning Component: Using
e.force:navigateToSObject
- Visualforce using lightning out:
sforce.one.navigateToSObject
It looks like there is some caching issue after redirect.
To resolve this, I also turned off the cache as mentioned in this question, it didn't help: Lightning Experience: How to prevent the display of obsolete data?
Question is similar to Values are not updated in Lightning after record update but it does not have a proper answer.
I also know there is a known issue: Data updates are not reflected in UI after a Visualforce+Apex update in Lightning Experience. My scenario is different as it has a lightning component.
Please let me know if anyone else is facing similar issue; as this is most common use case to use a Lightning component or Visualforce for overriding standard button's action.
My code is pretty basic to just show the existing Account name with save button, can provide if required.
What I tried for navigation:
Iteration 1:
var navigationSObject = $A.get("e.force:navigateToSObject");
navigationSObject.setParams({
"recordId": component.get("v.recordId")
});
navigationSObject.fire();
And using sforce.one.navigateToSObject
when a VF page is used using Lightning out.
Iteration 2 (as per question: Values are not updated in Lightning after record update):
var navigationSObject = $A.get("e.force:navigateToSObject");
navigationSObject.setParams({
"recordId": component.get("v.recordId")
});
$A.get('e.force:refreshView').fire();
navigationSObject.fire();