This commit is contained in:
2026-08-08 20:55:01 +02:00
parent 8f3fd6a127
commit 93800e8460
5 changed files with 80 additions and 9 deletions
+12 -1
View File
@@ -1,11 +1,12 @@
<script lang="ts" setup>
import 'highlight.js/styles/github-dark.css'
import {computed, nextTick, ref, watch} from 'vue';
import {computed, nextTick, onMounted, onUnmounted, ref, watch} from 'vue';
import {storeToRefs} from 'pinia';
import {useMessageStore} from '@/stores/message';
import {useServerStore} from '@/stores/server';
import {useUserStore} from "@/stores/user.ts";
import {useMarkdown} from '@/composables/useMarkdown'
import {onReloadAll} from '@/plugins/events.ts'
const props = defineProps<{
serverId: string
@@ -186,6 +187,16 @@ const returnToRecentMessages = async () => {
await markCurrentChannelRead(channelId.value);
};
let stopReloadAll: (() => void) | null = null;
onMounted(() => {
stopReloadAll = onReloadAll(() => messageStore.fetchMessages(channelId.value));
});
onUnmounted(() => {
stopReloadAll?.();
});
// Only explicit initial loads and realtime messages received while at the
// bottom request an automatic scroll. Pagination restores its own anchor.
watch(messages, async () => {