Skip to content

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

fix: avoid revalidating formulas if transient error

Pranav C7dd1acd9dcee
diff --git a/packages/nocodb/src/controllers/internal/modules/UiPost.operations.ts b/packages/nocodb/src/controllers/internal/modules/UiPost.operations.ts
index 806ac2d7ff..ae187b397c 100644
--- a/packages/nocodb/src/controllers/internal/modules/UiPost.operations.ts
+++ b/packages/nocodb/src/controllers/internal/modules/UiPost.operations.ts
@@ -34,7 +34,8 @@ import { ExtensionsService } from '~/services/extensions.service';
@Injectable()
export class UiPostOperations
- implements InternalApiModule<InternalPOSTResponseType> {
+ implements InternalApiModule<InternalPOSTResponseType>
+{
constructor(
protected dataTableService: DataTableService,
protected tablesService: TablesService,
@@ -58,7 +59,7 @@ export class UiPostOperations
protected syncService: SyncService,
protected readonly nocoJobsService: NocoJobsService,
protected extensionsService: ExtensionsService,
- ) { }
+ ) {}
operations = [
'tableUpdate' as const,
'tableDelete' as const,
diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts
index 0d7c8b86dd..5ae60291cd 100644
--- a/packages/nocodb/src/db/BaseModelSqlv2.ts
+++ b/packages/nocodb/src/db/BaseModelSqlv2.ts
@@ -141,6 +141,7 @@ import NocoSocket from '~/socket/NocoSocket';
import { prepareMetaUpdateQuery } from '~/helpers/metaColumnHelpers';
import { supportsThumbnails } from '~/utils/attachmentUtils';
import { Profiler } from '~/helpers/profiler';
+import { isTransientError } from '~/helpers/db-error/utils';
dayjs.extend(utc);
@@ -644,7 +645,11 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {
skipSubstitutingColumnIds: options.skipSubstitutingColumnIds,
});
} catch (e) {
- if (validateFormula || !haveFormulaColumn(columns)) throw e;
+ // Check if this is a transient error (connection/timeout issue)
+ const isTransient = isTransientError(e);
+
+ if (isTransient || validateFormula || !haveFormulaColumn(columns))
+ throw e;
logger.log(e);
return this.list(args, {
ignoreViewFilterAndSort,
diff --git a/packages/nocodb/src/db/BaseModelSqlv2/relation-data-fetcher.ts b/packages/nocodb/src/db/BaseModelSqlv2/relation-data-fetcher.ts
index 9e9c6eeabc..8f956e5c0c 100644
--- a/packages/nocodb/src/db/BaseModelSqlv2/relation-data-fetcher.ts
+++ b/packages/nocodb/src/db/BaseModelSqlv2/relation-data-fetcher.ts
@@ -108,9 +108,9 @@ export const relationDataFetcher = (param: {
const view = relationColOpts.fk_target_view_id
? await View.get(refContext, relationColOpts.fk_target_view_id)
: await View.getFirstCollaborativeView(
- refContext,
- childBaseModel.model.id,
- );
+ refContext,
+ childBaseModel.model.id,
+ );
await childBaseModel.applySortAndFilter({
table: childTable,
where,
@@ -139,7 +139,7 @@ export const relationDataFetcher = (param: {
// get one extra record to check if there are more records in case of v3 api and nested
query.limit(
(+rest?.limit || 25) +
- (apiVersion === NcApiVersion.V3 && nested ? 1 : 0),
+ (apiVersion === NcApiVersion.V3 && nested ? 1 : 0),
);
query.offset(+rest?.offset || 0);
@@ -284,7 +284,7 @@ export const relationDataFetcher = (param: {
// get one extra record to check if there are more records in case of v3 api and nested
qb.limit(
(+rest?.limit || 25) +
- (apiVersion === NcApiVersion.V3 && nested ? 1 : 0),
+ (apiVersion === NcApiVersion.V3 && nested ? 1 : 0),
);
}
qb.offset(selectAllRecords ? 0 : +rest?.offset || 0);
@@ -669,7 +669,7 @@ export const relationDataFetcher = (param: {
// get one extra record to check if there are more records in case of v3 api and nested
query.limit(
(+rest?.limit || 25) +
- (apiVersion === NcApiVersion.V3 && nested ? 1 : 0),
+ (apiVersion === NcApiVersion.V3 && nested ? 1 : 0),
);
query.offset(+rest?.offset || 0);
return baseModel.isSqlite
@@ -902,10 +902,10 @@ export const relationDataFetcher = (param: {
listArgs = dependencyFields;
try {
listArgs.filterArr = JSON.parse(listArgs.filterArrJson);
- } catch (e) { }
+ } catch (e) {}
try {
listArgs.sortArr = JSON.parse(listArgs.sortArrJson);
- } catch (e) { }
+ } catch (e) {}
}
const parentTable = await (
diff --git a/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts b/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts
index 3d8a018b79..a04c8f112e 100644
--- a/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts
+++ b/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts
@@ -10,7 +10,6 @@ import {
} from 'nocodb-sdk';
import { getColumnName } from 'src/helpers/dbHelpers';
import { DBErrorExtractor } from 'src/helpers/db-error/extractor';
-import { isTransientError } from 'src/helpers/db-error/utils';
import genRollupSelectv2 from '../genRollupSelectv2';
import { replaceDelimitedWithKeyValuePg } from '../aggregations/pg';
import { replaceDelimitedWithKeyValueSqlite3 } from '../aggregations/sqlite3';
@@ -30,6 +29,7 @@ import type {
TAliasToColumn,
TAliasToColumnParam,
} from './formula-query-builder.types';
+import { isTransientError } from '~/helpers/db-error/utils';
import NocoCache from '~/cache/NocoCache';
import { getRefColumnIfAlias } from '~/helpers';
import { NcBaseErrorv2, NcError } from '~/helpers/catchError';
diff --git a/packages/nocodb/src/services/view-columns.service.ts b/packages/nocodb/src/services/view-columns.service.ts
index 57c1da3c35..a0040a0017 100644
--- a/packages/nocodb/src/services/view-columns.service.ts
+++ b/packages/nocodb/src/services/view-columns.service.ts
@@ -99,7 +99,7 @@ export class ViewColumnsService {
}
async columnUpdate(
- context: NcContext,
+ context: NcContext,
param: {
viewId: string;
columnId: string;