Page MenuHomePhabricator

OCR preferences are saved too often
Open, Needs TriagePublicBUG REPORT

Description

After selecting an OCR engine and a couple of languages, when you navigate to a new page to proofread (and don't change any OCR settings), multiple API requests are sent to save the OCR preferences. None need to be sent unless something is changed.

When opening an editing page, it looks like an API request is sent (to action=options&change=wikisource-ocr…) once at the start after it's read the preference, and then again each time it adds a language to the list, e.g.:

wikisource-ocr={"engine":"google","langs":[],"showOnboarding":false}
wikisource-ocr={"engine":"google","langs":["az-cyrl"],"showOnboarding":false}
wikisource-ocr={"engine":"google","langs":["az-cyrl","ar"],"showOnboarding":false}

It should:

  • not try to save if nothing's changed; and
  • only save once with all data when it does.

The same applies for anon users where the data is saved to localStorage.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

This could be done by only saving the preferences when the config popup is closed.

Change #1019436 had a related patch set uploaded (by Kolakachi; author: Kolakachi):

[mediawiki/extensions/Wikisource@master] Fixed OCR preferences are saved too often

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