I’m opening here a proposal so that we clarify the behaviour of using the browser Back button with page edition. This discussion started with @mflorea as part of https://jira.xwiki.org/browse/XWIKI-17658.
To sum up a bit the history:
- we used to have before XWiki 11.2RC1 a behaviour such as when using the back button the edition form was keeping unchanged, displaying the browser cached content. It means that if you were editing a document and move to another page by mistake, you could use the back button and your changes were not lost
- in XWiki 11.2RC1 we introduced the management of conflict edition (https://jira.xwiki.org/browse/XWIKI-6665): this mechanism works with a version of the page. Starting there we encountered the following problem when using the back button: the changes were not lost, but when using back button after a first save you were hitting a conflict (because the version was not reload when using back)
- we fixed this “bug” in XWiki 11.3.1 / 11.4RC1 (https://jira.xwiki.org/browse/XWIKI-16343) by forcing a reload of the browser when the user uses the back button and the version changed in the meantime
Right now I see 2 solutions:
Solution 1: We use the current solution, it means that whenever you use back button and the version changed the browser will be reloaded with latest version of the document, and the content you might have cached in browser will be lost. For me, this is an acceptable solution since:
- we have mechanism to protect against leaving the editor during the edition with a confirmation window to prevent about possible loss of data
- we are going towards more and more in-place editing so using the back button in the future for edition should be pretty rare
Solution 2: We revert all the changes I did for https://jira.xwiki.org/browse/XWIKI-16343, so basically we always retrieve the cached content from the browser, but we also always rely on the conflict detection mechanism. I performed a trial locally and right now something as simple as adding a line to the cached content (already saved) will trigger a conflict window (because of saving by using an old version). Maybe there’s some work to do to improve a bit the automatic merge there (personally I’m not even sure why it detects a conflict there, but I didn’t investigated much). But anyway, there will still be a high risk to introduce a conflict like that and so to hit the conflict window.
Please tell me what do you think on that subject, I tried to sum up there but you might find more details in the discussion we had with Marius on the comments of https://jira.xwiki.org/browse/XWIKI-17658.