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() {
7299}7299}
73007300
7301export async function openCharacterChat(file_name) {7301export async function openCharacterChat(file_name) {
7302 await waitUntilCondition(() => !isChatSaving, debounce_timeout.extended, 10);
7302 await clearChat();7303 await clearChat();
7303 characters[this_chid]['chat'] = file_name;7304 characters[this_chid]['chat'] = file_name;
7304 chat.length = 0;7305 chat.length = 0;
public/scripts/group-chats.js+2 -0
@@ -16,6 +16,7 @@ import {
16 localizePagination,16 localizePagination,
17 renderPaginationDropdown,17 renderPaginationDropdown,
18 paginationDropdownChangeHandler,18 paginationDropdownChangeHandler,
19 waitUntilCondition,
19} from './utils.js';20} from './utils.js';
20import { RA_CountCharTokens, humanizedDateTime, dragElement, favsToHotswap, getMessageTimeStamp } from './RossAscends-mods.js';21import { RA_CountCharTokens, humanizedDateTime, dragElement, favsToHotswap, getMessageTimeStamp } from './RossAscends-mods.js';
21import { power_user, loadMovingUIState, sortEntitiesList } from './power-user.js';22import { power_user, loadMovingUIState, sortEntitiesList } from './power-user.js';
@@ -1912,6 +1913,7 @@ export async function getGroupPastChats(groupId) {
1912}1913}
19131914
1914export async function openGroupChat(groupId, chatId) {1915export async function openGroupChat(groupId, chatId) {
1916 await waitUntilCondition(() => !isChatSaving, debounce_timeout.extended, 10);
1915 const group = groups.find(x => x.id === groupId);1917 const group = groups.find(x => x.id === groupId);
19161918
1917 if (!group || !group.chats.includes(chatId)) {1919 if (!group || !group.chats.includes(chatId)) {