WI entry update slash commands use debounced
- WI entry updates utilize debounced save - Trade-off between consistency of possible data loss and performance issues in STscript loops that update multiple things in a WI file are not worth it.
This commit is contained in:
parent
731d2864de
commit
0975843f1d
|
@ -1057,7 +1057,7 @@ function registerWorldInfoSlashCommands() {
|
||||||
entry.content = content;
|
entry.content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
await saveWorldInfo(file, data, true);
|
await saveWorldInfo(file, data);
|
||||||
reloadEditor(file);
|
reloadEditor(file);
|
||||||
|
|
||||||
return String(entry.uid);
|
return String(entry.uid);
|
||||||
|
@ -1108,7 +1108,7 @@ function registerWorldInfoSlashCommands() {
|
||||||
setOriginalDataValue(data, uid, originalDataKeyMap[field], entry[field]);
|
setOriginalDataValue(data, uid, originalDataKeyMap[field], entry[field]);
|
||||||
}
|
}
|
||||||
|
|
||||||
await saveWorldInfo(file, data, true);
|
await saveWorldInfo(file, data);
|
||||||
reloadEditor(file);
|
reloadEditor(file);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -1934,7 +1934,7 @@ function displayWorldEntries(name, data, navigation = navigation_option.none, fl
|
||||||
|
|
||||||
if (counter > 0) {
|
if (counter > 0) {
|
||||||
toastr.info(`Backfilled ${counter} titles`);
|
toastr.info(`Backfilled ${counter} titles`);
|
||||||
await saveWorldInfo(name, data, true);
|
await saveWorldInfo(name, data);
|
||||||
updateEditor(navigation_option.previous);
|
updateEditor(navigation_option.previous);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1994,7 +1994,7 @@ function displayWorldEntries(name, data, navigation = navigation_option.none, fl
|
||||||
|
|
||||||
console.table(Object.keys(data.entries).map(uid => data.entries[uid]).map(x => ({ uid: x.uid, key: x.key.join(','), displayIndex: x.displayIndex })));
|
console.table(Object.keys(data.entries).map(uid => data.entries[uid]).map(x => ({ uid: x.uid, key: x.key.join(','), displayIndex: x.displayIndex })));
|
||||||
|
|
||||||
await saveWorldInfo(name, data, true);
|
await saveWorldInfo(name, data);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
//$("#world_popup_entries_list").disableSelection();
|
//$("#world_popup_entries_list").disableSelection();
|
||||||
|
@ -3277,7 +3277,7 @@ async function _save(name, data) {
|
||||||
eventSource.emit(event_types.WORLDINFO_UPDATED, name, data);
|
eventSource.emit(event_types.WORLDINFO_UPDATED, name, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveWorldInfo(name, data, immediately) {
|
async function saveWorldInfo(name, data, immediately = false) {
|
||||||
if (!name || !data) {
|
if (!name || !data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue