Page MenuHomePhabricator

Live Preview: "Show changes" does not reset the diff area when there are no differences
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

While editing, if I undo any unsaved changes I have made to the page and click "Show changes", it does not remove any changes that are currently displayed in the diff area.

Steps to reproduce problem
  1. Enable Live Preview (go to Preferences > Editing and check "Show previews without reloading the page")
  2. Find a page and open the source editor
  3. Make an edit
  4. Click "Show changes"
  5. Undo the edit from 3 (so that you are back to where you started, with no changes having been made to the page)
  6. Click "Show changes"

Expected behavior: The diff area is empty, reflecting the fact there has been no changes
Observed behavior: The diff area stays the same as it was in step 4

Environment

Wiki(s): https://en.wikisource.beta.wmflabs.org MediaWiki 1.38.0-alpha (d2917ab) 00:02, 18 October 2021

Screenshots (if applicable):

This is the page to start with, with no changes:

diff_reset_start.png (1×1 px, 178 KB)

This is the page after having made a change and clicked "Show changes":

diff_reset_change.png (1×1 px, 144 KB)

This is the page after undoing the change and clicking "Show changes". Still shows the "foo" change even though it is no longer there:

diff_reset_undo.png (1×1 px, 154 KB)

Event Timeline

Change 732029 had a related patch set uploaded (by Fomafix; author: Fomafix):

[mediawiki/core@master] mediawiki.action.edit.preview: Clear diff on empty change

https://gerrit.wikimedia.org/r/732029

Change 732029 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.action.edit.preview: Use same UX as in normal diff

https://gerrit.wikimedia.org/r/732029