As a follow up to this question:
Add URL Parameter or another method to prevent action on browser refresh - Lightning Out / Component
The solution does not work in lightning. The basics of what I am trying to achieve is as follows:
URL Button on Lightning Page - Prefer not to do quick actions as we have many extension packages and would have to duplicate them all over. a URL button can goto a single page in our base package
On click of that button user is directed to the VF page in lightning and an action is performed
Issues
- If they refresh the browser while on that page the action is performed again.
- If the refresh the browser during the action (can take 5-10 seconds) the action is performed again. This means checking for result records will not work as a gate keeper)
So the question becomes:
- How to prevent the VF page from taking action if it is currently being displayed and the browser is refreshed? Is there a way to detect, and persist that detection, directly or indirectly a refresh
- I can use lightning components out in the solution if necessary
- Is there a way to detect refresh in lightning like there is in classic with window.performance which does not detect reload in lightning
I have tried using URL parameters but they are not maintained in lightning due to the iframe. And window .performance does not seems to work