If any document remains opened for some time (example 10 mins or more) in edit mode and then tried to save after that then save is discarded and document is just refreshing
It sounds like your page is removed from the list of stored pages. XPages stores a limited number of pages in either memory or on disk depending on how server page persistence is set up for your application. So my guess is that you are opening other pages from the application in separate browser tabs.
Once you hit the limit pages are removed from the list in order of appearence. This means that XPages has no knowledge of the component tree for the particular page which is no longer stored. This explains why your changes are 'discarded' and why the page is reloaded.
The default number of stored pages is only 4 in 8.5.x and 16 in 9.0.x.
My recommendation is that you increase this number by changing the server page persistence settings on the Persistence tab of Xsp Properties.
You should also be aware of the option to mark specific XPages to not store state by setting the property viewState
to "nostate"
on the xp:view component. This is useful for readonly pages and for 'xagents' that do not need to store state.
Notice: the keepSessionAlive control will not help here as you need to 'keep the component tree alive' - not the session.
I guess you may have hit a "session timeout".
What I will suggest that you do is to set a long application timeout and a short session timeout - and use a "keep alive" custom control to make sure that the session will not time out while you are editing it.
I have tried to explain some of these features in a blog article that may give you a better overview ;-)
/John