Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25830

BlockNote shows outdated content when editing again a page left while it was kept in the browser's back/forward cache

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • 19.0.0-rc-1, 18.10.0
    • 18.4.0
    • BlockNote
    • None
    • Unknown

    Description

      Steps to reproduce, with Chrome 158 or later:

      1. Edit a page in-place with the BlockNote editor (realtime), alone, change something and save.
      2. Switch to the wiki editor (e.g. using the edit menu), change the content there, and use Save & View.
      3. Edit the page in-place with BlockNote again.

      Expected: the editor shows the content saved at step 2.

      Actual: the editor shows the content from step 1. The changes made at step 2 are lost as soon as the page is saved from BlockNote (e.g. image parameters added in the wiki editor disappear).

      Cause

      Since Chrome 158, the page edited in-place is kept frozen in the browser's back/forward cache (bfcache) when the user navigates away, instead of being destroyed (see XWIKI-25826 for the same problem with the realtime CKEditor). The collaboration provider removes its awareness state on pagehide, so the other participants don't list it anymore, but its WebSocket connection stays open while the page is frozen. The server keeps the collaboration room, and its update history, as long as a client is connected, so the next BlockNote session joins that room and synchronizes with the content of the previous session instead of loading the saved document.

      Verified with a diagnostic functional test, on Chrome 158, at the same commit and with the same artifacts: with the bfcache, pagehide with persisted=true followed by freeze when switching to the wiki editor, and the second BlockNote session shows the content of the first session; with Chrome started with --disable-features=BackForwardCache, persisted=false and the second session shows the saved content. ImageIT#editImage and CollaborationIT#restrictScriptMacroExecution fail in the Chrome configurations of the environment tests since Chrome 158, and pass with the bfcache disabled.

      Fix

      Disconnect the collaboration provider when the page is stored in the bfcache (pagehide with persisted), and reconnect it, restoring the awareness state, when the page is restored from the bfcache (pageshow with persisted). The synchronization done on reconnect already handles the case where the room was replaced by a new session in the mean time.

      Attachments

        Issue Links

          Activity

            People

              MichaelHamann Michael Hamann
              MichaelHamann Michael Hamann
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: