Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(Sentry TypeError): undefined is not an object (evaluating 're.value.getAbstractType')

Ramesh Manee665a42e4349
diff --git a/packages/nc-gui/components/smartsheet/Cell.vue b/packages/nc-gui/components/smartsheet/Cell.vue
index bcf9ff51dd..582b9018bb 100644
--- a/packages/nc-gui/components/smartsheet/Cell.vue
+++ b/packages/nc-gui/components/smartsheet/Cell.vue
@@ -63,7 +63,7 @@ const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))
const { currentRow, state } = useSmartsheetRowStoreOrThrow()
-const { sqlUis } = storeToRefs(useBase())
+const baseStore = useBase()
const { generatingRows, generatingColumns } = useNocoAi()
@@ -79,9 +79,7 @@ const isGenerating = computed(
pk.value && column.value.id && generatingRows.value.includes(pk.value) && generatingColumns.value.includes(column.value.id),
)
-const sourceId = meta.value?.source_id || column.value?.source_id
-
-const sqlUi = ref(sourceId && sqlUis.value[sourceId] ? sqlUis.value[sourceId] : Object.values(sqlUis.value)[0])
+const sqlUi = computed(() => baseStore.getSqlUiBySourceId(meta.value?.source_id || column.value?.source_id))
const abstractType = computed(() => column.value && sqlUi.value.getAbstractType(column.value))
diff --git a/packages/nc-gui/components/smartsheet/PlainCell.vue b/packages/nc-gui/components/smartsheet/PlainCell.vue
index 5d52d4da83..a833aea079 100644
--- a/packages/nc-gui/components/smartsheet/PlainCell.vue
+++ b/packages/nc-gui/components/smartsheet/PlainCell.vue
@@ -20,7 +20,7 @@ const { metas } = useMetas()
const column = toRef(props, 'column')
-const { sqlUis } = storeToRefs(useBase())
+const baseStore = useBase()
const basesStore = useBases()
@@ -28,11 +28,7 @@ const { basesUser } = storeToRefs(basesStore)
const { isXcdbBase, isMysql } = useBase()
-const sqlUi = ref(
- column.value?.source_id && sqlUis.value[column.value?.source_id]
- ? sqlUis.value[column.value?.source_id]
- : Object.values(sqlUis.value)[0],
-)
+const sqlUi = computed(() => baseStore.getSqlUiBySourceId(column.value?.source_id))
const abstractType = computed(() => column.value && sqlUi.value.getAbstractType(column.value))
diff --git a/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue b/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue
index 9ff28fc562..267cf75707 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue
@@ -66,13 +66,9 @@ const checkTypeFunctions: Record<string, (column: ColumnType, abstractType?: str
type FilterType = keyof typeof checkTypeFunctions
-const { sqlUis } = storeToRefs(useBase())
+const baseStore = useBase()
-const sqlUi = ref(
- column.value?.source_id && sqlUis.value[column.value?.source_id]
- ? sqlUis.value[column.value?.source_id]
- : Object.values(sqlUis.value)[0],
-)
+const sqlUi = computed(() => baseStore.getSqlUiBySourceId(column.value?.source_id))
const abstractType = computed(() => column.value && sqlUi.value.getAbstractType(column.value))
diff --git a/packages/nc-gui/store/base.ts b/packages/nc-gui/store/base.ts
index 387b22844c..11e1e97bca 100644
--- a/packages/nc-gui/store/base.ts
+++ b/packages/nc-gui/store/base.ts
@@ -78,6 +78,17 @@ export const useBase = defineStore('baseStore', () => {
return temp
})
+ /**
+ * @Note - Always use this fn inside computed as `sqlUis` is computed property
+ */
+ function getSqlUiBySourceId(sourceId?: string): any {
+ if (sourceId && sqlUis.value[sourceId]) {
+ return sqlUis.value[sourceId]
+ }
+
+ return Object.values(sqlUis.value)[0]
+ }
+
function getBaseType(sourceId?: string) {
return sources.value.find((source) => source.id === sourceId)?.type || ClientType.MYSQL
}
@@ -302,6 +313,7 @@ export const useBase = defineStore('baseStore', () => {
isSnowflake,
isDatabricks,
sqlUis,
+ getSqlUiBySourceId,
isSharedBase,
isSharedErd,
loadProjectMetaInfo,
diff --git a/packages/nocodb-sdk-v2/src/lib/Api.ts b/packages/nocodb-sdk-v2/src/lib/Api.ts
index 2c5660ef79..0a0e96c1b7 100644
--- a/packages/nocodb-sdk-v2/src/lib/Api.ts
+++ b/packages/nocodb-sdk-v2/src/lib/Api.ts
@@ -367,15 +367,9 @@ export interface ViewList {
lock_type: 'collaborative' | 'locked' | 'personal';
/** Indicates if this is the default view. */
is_default?: boolean;
- /**
- * User ID of the creator.
- * @format uuid
- */
+ /** User ID of the creator. */
created_by: string;
- /**
- * User ID of the owner. Applicable only for personal views.
- * @format uuid
- */
+ /** User ID of the owner. Applicable only for personal views. */
owned_by?: string;
/**
* Timestamp of creation.
@@ -432,10 +426,7 @@ export interface ViewBaseInUpdate {
* - In case of partial list, fields not included in the list will be excluded from the view.
*/
export type ViewFields = {
- /**
- * Unique identifier for the field.
- * @format uuid
- */
+ /** Unique identifier for the field. */
field_id: string;
/** Indicates whether the field should be displayed in the view. */
show: boolean;
@@ -466,10 +457,7 @@ export type ViewRowColour =
| {
/** Mode of row coloring. In this mode, the color is selected based on a single select field. */
mode: 'select';
- /**
- * Single select field ID to be used for colouring rows in the view.
- * @format uuid
- */
+ /** Single select field ID to be used for colouring rows in the view. */
field_id: string;
/** Whether to additionally apply the color as row background. */
apply_as_row_background?: boolean;
@@ -478,10 +466,7 @@ export type ViewRowColour =
export interface ViewOptionsGrid {
/** List of groups to be applied on the grid view. */
groups?: {
- /**
- * Identifier for the field being sorted.
- * @format uuid
- */
+ /** Identifier for the field being sorted. */
field_id: string;
/**
* Direction of the group, either 'asc' (ascending) or 'desc' (descending).
@@ -498,10 +483,7 @@ export interface ViewOptionsGrid {
export interface ViewOptionsKanban {
stack_by: {
- /**
- * Single select field ID to be used for stacking cards in kanban view.
- * @format uuid
- */
+ /** Single select field ID to be used for stacking cards in kanban view. */
field_id: string;
/**
* Order of the stacks in kanban view. If not provided, the order will be determined by options listed in associated field.
@@ -510,33 +492,21 @@ export interface ViewOptionsKanban {
*/
stack_order?: string[];
};
- /**
- * Attachment field ID to be used as cover image in kanban view. If not provided, cover field configuration is skipped.
- * @format uuid
- */
+ /** Attachment field ID to be used as cover image in kanban view. If not provided, cover field configuration is skipped. */
cover_field_id?: string;
}
export interface ViewOptionsCalendar {
date_ranges: {
- /**
- * Date field ID to be used as start date in calendar view.
- * @format uuid
- */
+ /** Date field ID to be used as start date in calendar view. */
start_date_field_id: string;
- /**
- * Date field ID to be used as end date in calendar view.
- * @format uuid
- */
+ /** Date field ID to be used as end date in calendar view. */
end_date_field_id?: string;
}[];
}
export interface ViewOptionsGallery {
- /**
- * Attachment field ID to be used as cover image in gallery view. Is optional, if not provided, the first attachment field will be used.
- * @format uuid
- */
+ /** Attachment field ID to be used as cover image in gallery view. Is optional, if not provided, the first attachment field will be used. */
cover_field_id?: string;
}
@@ -720,23 +690,14 @@ export type ViewUpdate = ViewBaseInUpdate &
);
export type View = {
- /**
- * Unique identifier for the view.
- * @format uuid
- */
+ /** Unique identifier for the view. */
id: string;
/** Indicates if this is the default view. Omitted if not the default view. */
is_default?: boolean;
} & ViewBase & {
- /**
- * User ID of the creator.
- * @format uuid
- */
+ /** User ID of the creator. */
created_by?: string;
- /**
- * User ID of the owner.
- * @format uuid
- */
+ /** User ID of the owner. */
owned_by?: string;
/**
* Timestamp of creation.