diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue b/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue index d0b9686d7c..e458428b3f 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue @@ -186,6 +186,18 @@ function scrollToComment(commentId: string) { } } +function scrollToAudit(auditId?: string) { + if (!auditId) return + + const auditEl = commentsWrapperEl.value?.querySelector(`.nc-audit-item.${auditId}`) + if (auditEl) { + auditEl.scrollIntoView({ + behavior: 'smooth', + block: 'center', + }) + } +} + watch(commentsWrapperEl, () => { setTimeout(() => { nextTick(() => { @@ -261,6 +273,17 @@ function handleResetHoverEffect() { hoveredCommentId.value = null } + +watch( + () => audits.value.length, + (auditCount) => { + nextTick(() => { + setTimeout(() => { + scrollToAudit(audits.value[auditCount - 1]?.id) + }, 100) + }) + }, +) -
+
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vue index f03bb9d7c7..f926ca0d5e 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue @@ -315,7 +315,9 @@ const reloadHook = createEventHook() reloadHook.on(() => { reloadParentRowHook?.trigger({ shouldShowLoading: false }) if (isNew.value) return - _loadRow(null, true) + + _loadRow(undefined, true) + loadAudits(rowId.value, false) }) provide(ReloadRowDataHookInj, reloadHook) diff --git a/packages/nc-gui/components/smartsheet/toolbar/FieldListWithSearch.vue b/packages/nc-gui/components/smartsheet/toolbar/FieldListWithSearch.vue index 4c4fa74b9f..b77432fc0a 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/FieldListWithSearch.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/FieldListWithSearch.vue @@ -1,5 +1,5 @@