Wait for current chat to finish saving before allowing to switch

e52b3afea9dfaf2e1a026e92c17ea4cca4958eff

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +3 -0Showing whitespace changes
public/script.js+1 -0
@@ -7299,6 +7299,7 @@ function getFirstMessage() {
72997299}
73007300
73017301export async function openCharacterChat(file_name) {
7302+ await waitUntilCondition(() => !isChatSaving, debounce_timeout.extended, 10);
73027303 await clearChat();
73037304 characters[this_chid]['chat'] = file_name;
73047305 chat.length = 0;
public/scripts/group-chats.js+2 -0
@@ -16,6 +16,7 @@ import {
1616 localizePagination,
1717 renderPaginationDropdown,
1818 paginationDropdownChangeHandler,
19+ waitUntilCondition,
1920} from './utils.js';
2021import { RA_CountCharTokens, humanizedDateTime, dragElement, favsToHotswap, getMessageTimeStamp } from './RossAscends-mods.js';
2122import { power_user, loadMovingUIState, sortEntitiesList } from './power-user.js';
@@ -1912,6 +1913,7 @@ export async function getGroupPastChats(groupId) {
19121913}
19131914
19141915export async function openGroupChat(groupId, chatId) {
1916+ await waitUntilCondition(() => !isChatSaving, debounce_timeout.extended, 10);
19151917 const group = groups.find(x => x.id === groupId);
19161918
19171919 if (!group || !group.chats.includes(chatId)) {