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