Callback should only be run after completion of API save request

Bug: T357212
Change-Id: Icee40b8f9b642e516583998f98cf0072a9e37dee
This commit is contained in:
Jon Robson 2024-02-12 08:52:46 -08:00
parent 1637b2bbdf
commit 2b4b256d4e
2 changed files with 4 additions and 3 deletions

View file

@ -56,8 +56,9 @@ function toggleDocClassAndSave( featureName, value, config ) {
// Ideally this should be taken care of via a single core helper function.
mw.util.debounce( function () {
api = api || new mw.Api();
api.saveOption( pref.preferenceKey, value );
callback();
api.saveOption( pref.preferenceKey, value ).then( () => {
callback();
} );
}, 100 )();
// END FIXME.
} else {

View file

@ -1,6 +1,6 @@
{
"name": "@wikimedia/mediawiki.skins.clientpreferences",
"version": "1.1.0",
"version": "1.1.1",
"private": false,
"main": "clientPreferences.js",
"author": "Wikimedia Foundation",