Browse Source

fix(nc-gui): Fixed issue with comment not loadning and syncing with the grid comment count

pull/6574/head
Muhammed Mustafa 1 year ago
parent
commit
a8f96c70b4
  1. 6
      packages/nc-gui/components/smartsheet/expanded-form/Comments.vue
  2. 2
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  3. 8
      packages/nc-gui/composables/useExpandedFormStore.ts

6
packages/nc-gui/components/smartsheet/expanded-form/Comments.vue

@ -8,9 +8,9 @@ const { loadCommentsAndLogs, commentsAndLogs, saveComment: _saveComment, comment
const commentsWrapperEl = ref<HTMLDivElement>() const commentsWrapperEl = ref<HTMLDivElement>()
onMounted(async () => { const auditTabDomRef = (e: HTMLElement) => {
await loadCommentsAndLogs() e.scrollTop = e.scrollHeight
}) }
const { user } = useGlobal() const { user } = useGlobal()

2
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -221,11 +221,13 @@ onMounted(async () => {
isLoading.value = true isLoading.value = true
if (props.loadRow) { if (props.loadRow) {
await _loadRow() await _loadRow()
await loadCommentsAndLogs()
} }
if (props.rowId) { if (props.rowId) {
try { try {
await _loadRow(props.rowId) await _loadRow(props.rowId)
await loadCommentsAndLogs()
} catch (e: any) { } catch (e: any) {
if (e.response?.status === 404) { if (e.response?.status === 404) {
// todo: i18n // todo: i18n

8
packages/nc-gui/composables/useExpandedFormStore.ts

@ -143,6 +143,8 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
comment.value = '' comment.value = ''
reloadTrigger?.trigger()
await loadCommentsAndLogs() await loadCommentsAndLogs()
} catch (e: any) { } catch (e: any) {
message.error(e.message) message.error(e.message)
@ -269,12 +271,6 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
addOrEditStackRow(row.value, isNewRow) addOrEditStackRow(row.value, isNewRow)
} }
// trim the display value if greater than 20chars
const trimmedDisplayValue =
displayValue.value && displayValue.value?.length > 20 ? `${displayValue.value?.substring(0, 20)}...` : displayValue.value
message.success(`${trimmedDisplayValue || 'Row'} updated successfully.`)
changedColumns.value = new Set() changedColumns.value = new Set()
} catch (e: any) { } catch (e: any) {
message.error(`${t('msg.error.rowUpdateFailed')}: ${await extractSdkResponseErrorMsg(e)}`) message.error(`${t('msg.error.rowUpdateFailed')}: ${await extractSdkResponseErrorMsg(e)}`)

Loading…
Cancel
Save