Browse Source

Merge pull request #9112 from nocodb/nc-fix/sentry-errors

Nc fix/sentry errors
pull/9124/head
Pranav C 4 months ago committed by GitHub
parent
commit
46997de3bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 21
      packages/nc-gui/app.vue
  2. 2
      packages/nc-gui/components/smartsheet/Kanban.vue
  3. 2
      packages/nc-gui/components/smartsheet/expanded-form/RichComment.vue
  4. 8
      packages/nc-gui/composables/useExtensions.ts
  5. 2
      packages/nc-gui/composables/useKanbanViewStore.ts
  6. 2
      packages/nc-gui/composables/useSmartsheetStore.ts
  7. 7
      packages/nc-gui/composables/useViewColumns.ts
  8. 4
      packages/nc-gui/composables/useViewData.ts
  9. 4
      packages/nc-gui/store/bases.ts

21
packages/nc-gui/app.vue

@ -96,6 +96,27 @@ onMounted(() => {
refreshCommandPalette() refreshCommandPalette()
}) })
}) })
// ref: https://github.com/vuejs/vue-cli/issues/7431#issuecomment-1793385162
// Stop error resizeObserver
const debounce = (callback: (...args: any[]) => void, delay: number) => {
let tid: any
return function (...args: any[]) {
const ctx = self
tid && clearTimeout(tid)
tid = setTimeout(() => {
callback.apply(ctx, args)
}, delay)
}
}
const _ = (window as any).ResizeObserver
;(window as any).ResizeObserver = class ResizeObserver extends _ {
constructor(callback: (...args: any[]) => void) {
callback = debounce(callback, 20)
super(callback)
}
}
</script> </script>
<template> <template>

2
packages/nc-gui/components/smartsheet/Kanban.vue

@ -278,6 +278,8 @@ async function onMove(event: any, stackKey: string) {
} }
const kanbanListScrollHandler = useDebounceFn(async (e: any) => { const kanbanListScrollHandler = useDebounceFn(async (e: any) => {
if (!e.target) return
if (e.target.scrollTop + e.target.clientHeight + INFINITY_SCROLL_THRESHOLD >= e.target.scrollHeight) { if (e.target.scrollTop + e.target.clientHeight + INFINITY_SCROLL_THRESHOLD >= e.target.scrollHeight) {
const stackTitle = e.target.getAttribute('data-stack-title') const stackTitle = e.target.getAttribute('data-stack-title')
const pageSize = appInfo.value.defaultLimit || 25 const pageSize = appInfo.value.defaultLimit || 25

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

@ -96,6 +96,8 @@ const editor = useEditor({
onBlur: (e) => { onBlur: (e) => {
const targetEl = e?.event.relatedTarget as HTMLElement const targetEl = e?.event.relatedTarget as HTMLElement
if (!targetEl) return
if ( if (
!targetEl?.closest( !targetEl?.closest(
'.comment-bubble-menu, .nc-rich-text-comment, .tippy-box, .nc-comment-save-btn, .rich-text-bottom-bar, .mention, .nc-mention-list, .tippy-content, .nc-comment-rich-editor', '.comment-bubble-menu, .nc-rich-text-comment, .tippy-box, .nc-comment-save-btn, .rich-text-bottom-bar, .mention, .nc-mention-list, .tippy-content, .nc-comment-rich-editor',

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

@ -188,6 +188,7 @@ export const useExtensions = createSharedComposable(() => {
return return
} }
try {
const { list } = await $api.extensions.list(baseId) const { list } = await $api.extensions.list(baseId)
const extensions = list?.map((ext: any) => new Extension(ext)) const extensions = list?.map((ext: any) => new Extension(ext))
@ -200,6 +201,9 @@ export const useExtensions = createSharedComposable(() => {
expanded: false, expanded: false,
} }
} }
} catch (e) {
console.log(e)
}
} }
const getExtensionIcon = (pathOrUrl: string) => { const getExtensionIcon = (pathOrUrl: string) => {
@ -345,7 +349,9 @@ export const useExtensions = createSharedComposable(() => {
() => base.value?.id, () => base.value?.id,
(baseId) => { (baseId) => {
if (baseId && !baseExtensions.value[baseId]) { if (baseId && !baseExtensions.value[baseId]) {
loadExtensionsForBase(baseId) loadExtensionsForBase(baseId).catch((e) => {
console.error(e)
})
} }
}, },
{ {

2
packages/nc-gui/composables/useKanbanViewStore.ts

@ -52,7 +52,7 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
if (!col) return if (!col) return
if (!search.value.query.trim()) return if (!search.value.query.trim()) return
if (['text', 'string'].includes(sqlUi.value.getAbstractType(col)) && col.dt !== 'bigint') { if (sqlUi.value && ['text', 'string'].includes(sqlUi.value.getAbstractType(col)) && col.dt !== 'bigint') {
where = `(${col.title},like,%${search.value.query.trim()}%)` where = `(${col.title},like,%${search.value.query.trim()}%)`
} else { } else {
where = `(${col.title},eq,${search.value.query.trim()})` where = `(${col.title},eq,${search.value.query.trim()})`

2
packages/nc-gui/composables/useSmartsheetStore.ts

@ -46,7 +46,7 @@ const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState(
if (!col) return if (!col) return
if (!search.value.query.trim()) return if (!search.value.query.trim()) return
if (['text', 'string'].includes(sqlUi.value.getAbstractType(col)) && col.dt !== 'bigint') { if (sqlUi.value && ['text', 'string'].includes(sqlUi.value.getAbstractType(col)) && col.dt !== 'bigint') {
where = `(${col.title},like,%${search.value.query.trim()}%)` where = `(${col.title},like,%${search.value.query.trim()}%)`
} else { } else {
where = `(${col.title},eq,${search.value.query.trim()})` where = `(${col.title},eq,${search.value.query.trim()})`

7
packages/nc-gui/composables/useViewColumns.ts

@ -434,7 +434,7 @@ const [useProvideViewColumns, useViewColumns] = useInjectionState(
scope: defineViewScope({ view: view.value }), scope: defineViewScope({ view: view.value }),
}) })
} }
try {
// sync with server if allowed // sync with server if allowed
if (!isPublic.value && isUIAllowed('viewFieldEdit') && gridViewCols.value[id]?.id) { if (!isPublic.value && isUIAllowed('viewFieldEdit') && gridViewCols.value[id]?.id) {
await $api.dbView.gridColumnUpdate(gridViewCols.value[id].id as string, { await $api.dbView.gridColumnUpdate(gridViewCols.value[id].id as string, {
@ -451,6 +451,11 @@ const [useProvideViewColumns, useViewColumns] = useInjectionState(
// fallback to reload // fallback to reload
await loadViewColumns() await loadViewColumns()
} }
} catch (e) {
// this could happen if user doesn't have permission to update view columns
// todo: find out root cause and handle with isUIAllowed
console.error(e)
}
} }
watch( watch(

4
packages/nc-gui/composables/useViewData.ts

@ -143,6 +143,7 @@ export function useViewData(
if (!ids?.length || ids?.some((id) => !id)) return if (!ids?.length || ids?.some((id) => !id)) return
try {
aggCommentCount.value = await $api.utils.commentCount({ aggCommentCount.value = await $api.utils.commentCount({
ids, ids,
fk_model_id: metaId.value as string, fk_model_id: metaId.value as string,
@ -152,6 +153,9 @@ export function useViewData(
const id = extractPkFromRow(row.row, meta.value?.columns as ColumnType[]) const id = extractPkFromRow(row.row, meta.value?.columns as ColumnType[])
row.rowMeta.commentCount = +(aggCommentCount.value?.find((c: Record<string, any>) => c.row_id === id)?.count || 0) row.rowMeta.commentCount = +(aggCommentCount.value?.find((c: Record<string, any>) => c.row_id === id)?.count || 0)
} }
} catch (e) {
console.error(e)
}
} }
const controller = ref() const controller = ref()

4
packages/nc-gui/store/bases.ts

@ -182,6 +182,7 @@ export const useBases = defineStore('basesStore', () => {
// actions // actions
const loadProject = async (baseId: string, force = false) => { const loadProject = async (baseId: string, force = false) => {
try {
if (!force && isProjectPopulated(baseId)) return bases.value.get(baseId) if (!force && isProjectPopulated(baseId)) return bases.value.get(baseId)
const _project = await api.base.read(baseId) const _project = await api.base.read(baseId)
@ -205,6 +206,9 @@ export const useBases = defineStore('basesStore', () => {
} }
bases.value.set(baseId, base) bases.value.set(baseId, base)
} catch (e: any) {
await message.error(await extractSdkResponseErrorMsg(e))
}
} }
const getSqlUi = async (baseId: string, sourceId: string) => { const getSqlUi = async (baseId: string, sourceId: string) => {

Loading…
Cancel
Save