Browse Source

fix: proper null value and exception handling

pull/9112/head
Pranav C 4 months ago
parent
commit
96f8a915f1
  1. 2
      packages/nc-gui/components/smartsheet/expanded-form/RichComment.vue
  2. 2
      packages/nc-gui/composables/useKanbanViewStore.ts
  3. 2
      packages/nc-gui/composables/useSmartsheetStore.ts
  4. 15
      packages/nc-gui/composables/useViewData.ts
  5. 4
      packages/nc-gui/store/bases.ts

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',

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()})`

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

@ -1,6 +1,15 @@
import {ViewTypes} from 'nocodb-sdk' import {ViewTypes} from 'nocodb-sdk'
import axios from 'axios' import axios from 'axios'
import type { Api, ColumnType, FormColumnType, FormType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk' import type {
Api,
ColumnType,
FormColumnType,
FormType,
GalleryType,
PaginatedType,
TableType,
ViewType
} from 'nocodb-sdk'
import type {ComputedRef, Ref} from 'vue' import type {ComputedRef, Ref} from 'vue'
import {NavigateDir} from '#imports' import {NavigateDir} from '#imports'
@ -143,6 +152,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 +162,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