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.
| @@ -1057,7 +1057,7 @@ function registerWorldInfoSlashCommands() { | |||
| 1057 | entry.content = content; | 1057 | entry.content = content; |
| 1058 | } | 1058 | } |
| 1059 | 1059 | ||
| 1060 | await saveWorldInfo(file, data, true); | 1060 | await saveWorldInfo(file, data); |
| 1061 | reloadEditor(file); | 1061 | reloadEditor(file); |
| 1062 | 1062 | ||
| 1063 | return String(entry.uid); | 1063 | return String(entry.uid); |
| @@ -1108,7 +1108,7 @@ function registerWorldInfoSlashCommands() { | |||
| 1108 | setOriginalDataValue(data, uid, originalDataKeyMap[field], entry[field]); | 1108 | setOriginalDataValue(data, uid, originalDataKeyMap[field], entry[field]); |
| 1109 | } | 1109 | } |
| 1110 | 1110 | ||
| 1111 | await saveWorldInfo(file, data, true); | 1111 | await saveWorldInfo(file, data); |
| 1112 | reloadEditor(file); | 1112 | reloadEditor(file); |
| 1113 | return ''; | 1113 | return ''; |
| 1114 | } | 1114 | } |
| @@ -1934,7 +1934,7 @@ function displayWorldEntries(name, data, navigation = navigation_option.none, fl | |||
| 1934 | 1934 | ||
| 1935 | if (counter > 0) { | 1935 | if (counter > 0) { |
| 1936 | toastr.info(`Backfilled ${counter} titles`); | 1936 | toastr.info(`Backfilled ${counter} titles`); |
| 1937 | await saveWorldInfo(name, data, true); | 1937 | await saveWorldInfo(name, data); |
| 1938 | updateEditor(navigation_option.previous); | 1938 | updateEditor(navigation_option.previous); |
| 1939 | } | 1939 | } |
| 1940 | }); | 1940 | }); |
| @@ -1994,7 +1994,7 @@ function displayWorldEntries(name, data, navigation = navigation_option.none, fl | |||
| 1994 | 1994 | ||
| 1995 | console.table(Object.keys(data.entries).map(uid => data.entries[uid]).map(x => ({ uid: x.uid, key: x.key.join(','), displayIndex: x.displayIndex }))); | 1995 | console.table(Object.keys(data.entries).map(uid => data.entries[uid]).map(x => ({ uid: x.uid, key: x.key.join(','), displayIndex: x.displayIndex }))); |
| 1996 | 1996 | ||
| 1997 | await saveWorldInfo(name, data, true); | 1997 | await saveWorldInfo(name, data); |
| 1998 | }, | 1998 | }, |
| 1999 | }); | 1999 | }); |
| 2000 | //$("#world_popup_entries_list").disableSelection(); | 2000 | //$("#world_popup_entries_list").disableSelection(); |
| @@ -3277,7 +3277,7 @@ async function _save(name, data) { | |||
| 3277 | eventSource.emit(event_types.WORLDINFO_UPDATED, name, data); | 3277 | eventSource.emit(event_types.WORLDINFO_UPDATED, name, data); |
| 3278 | } | 3278 | } |
| 3279 | 3279 | ||
| 3280 | async function saveWorldInfo(name, data, immediately) { | 3280 | async function saveWorldInfo(name, data, immediately = false) { |
| 3281 | if (!name || !data) { | 3281 | if (!name || !data) { |
| 3282 | return; | 3282 | return; |
| 3283 | } | 3283 | } |