diff --git a/frontend/app/components/workspace/CrmWorkspaceApp.vue b/frontend/app/components/workspace/CrmWorkspaceApp.vue index 2835334..8372271 100644 --- a/frontend/app/components/workspace/CrmWorkspaceApp.vue +++ b/frontend/app/components/workspace/CrmWorkspaceApp.vue @@ -1133,6 +1133,23 @@ function messageDeliveryLabel(item: CommItem) { return ""; } +// --------------------------------------------------------------------------- +// Comm thread auto-scroll +// --------------------------------------------------------------------------- +const commThreadSurfaceRef = ref(null); + +function scrollCommThreadToBottom() { + nextTick(() => { + const el = commThreadSurfaceRef.value; + if (el) el.scrollTop = el.scrollHeight; + }); +} + +// Scroll to bottom whenever timeline items change (thread switch or new message) +watch(clientTimelineItems, (items) => { + if (items.length) scrollCommThreadToBottom(); +}); + // --------------------------------------------------------------------------- // Watch: reset comm state on thread change // --------------------------------------------------------------------------- @@ -1624,7 +1641,7 @@ onBeforeUnmount(() => {
-
+