fix bug where closing the object view would scroll to the overview tab

This commit is contained in:
marlon-erler
2024-07-13 16:30:29 +02:00
parent 3c751af6b2
commit 61ddb4e32c
3 changed files with 16 additions and 3 deletions
+8 -1
View File
@@ -223,6 +223,9 @@ export const isChatVisible = React.createProxyState(
[isShowingObjects, isShowingChatInSplit],
() => isShowingObjects.value == false || isShowingChatInSplit.value == true
);
isShowingObjects.subscribeSilent(() => {
setTimeout(() => scrollToChat("instant"), 1);
});
export const newChatName = new React.State("");
@@ -246,7 +249,11 @@ export function closeChatView() {
export function selectChat(chat: Chat) {
selectedChat.value = chat;
chat.hasUnreadMessages.value = false;
document.getElementById("message-tab")?.scrollIntoView();
scrollToChat();
}
export function scrollToChat(behavior: ScrollBehavior = "smooth") {
document.getElementById("message-tab")?.scrollIntoView({ behavior });
}
export function toggleObjects() {