diff --git a/packages/nocodb/src/lib/models/FormViewColumn.ts b/packages/nocodb/src/lib/models/FormViewColumn.ts index fb4028e027..a8feb61db1 100644 --- a/packages/nocodb/src/lib/models/FormViewColumn.ts +++ b/packages/nocodb/src/lib/models/FormViewColumn.ts @@ -76,11 +76,19 @@ export default class FormViewColumn implements FormColumnType { await NocoCache.set(`${CacheScope.FORM_VIEW_COLUMN}:${fk_column_id}`, id); - await NocoCache.appendToList( - CacheScope.FORM_VIEW_COLUMN, - [column.fk_view_id], - `${CacheScope.FORM_VIEW_COLUMN}:${id}` - ); + // if cache is not present skip pushing it into the list to avoid unexpected behaviour + if ( + ( + await NocoCache.getList(CacheScope.FORM_VIEW_COLUMN, [ + column.fk_view_id, + ]) + )?.length + ) + await NocoCache.appendToList( + CacheScope.FORM_VIEW_COLUMN, + [column.fk_view_id], + `${CacheScope.FORM_VIEW_COLUMN}:${id}` + ); return this.get(id, ncMeta); } diff --git a/packages/nocodb/src/lib/models/GalleryViewColumn.ts b/packages/nocodb/src/lib/models/GalleryViewColumn.ts index 39e80dd45c..75ca96f4f1 100644 --- a/packages/nocodb/src/lib/models/GalleryViewColumn.ts +++ b/packages/nocodb/src/lib/models/GalleryViewColumn.ts @@ -72,11 +72,19 @@ export default class GalleryViewColumn { id ); - await NocoCache.appendToList( - CacheScope.GALLERY_VIEW_COLUMN, - [column.fk_view_id], - `${CacheScope.GALLERY_VIEW_COLUMN}:${id}` - ); + // if cache is not present skip pushing it into the list to avoid unexpected behaviour + if ( + ( + await NocoCache.getList(CacheScope.GALLERY_VIEW_COLUMN, [ + column.fk_view_id, + ]) + )?.length + ) + await NocoCache.appendToList( + CacheScope.GALLERY_VIEW_COLUMN, + [column.fk_view_id], + `${CacheScope.GALLERY_VIEW_COLUMN}:${id}` + ); return this.get(id, ncMeta); } diff --git a/packages/nocodb/src/lib/models/GridViewColumn.ts b/packages/nocodb/src/lib/models/GridViewColumn.ts index 8088c93037..f00bee3ea2 100644 --- a/packages/nocodb/src/lib/models/GridViewColumn.ts +++ b/packages/nocodb/src/lib/models/GridViewColumn.ts @@ -93,11 +93,19 @@ export default class GridViewColumn implements GridColumnType { await NocoCache.set(`${CacheScope.GRID_VIEW_COLUMN}:${fk_column_id}`, id); - await NocoCache.appendToList( - CacheScope.GRID_VIEW_COLUMN, - [column.fk_view_id], - `${CacheScope.GRID_VIEW_COLUMN}:${id}` - ); + // if cache is not present skip pushing it into the list to avoid unexpected behaviour + if ( + ( + await NocoCache.getList(CacheScope.GRID_VIEW_COLUMN, [ + column.fk_view_id, + ]) + )?.length + ) + await NocoCache.appendToList( + CacheScope.GRID_VIEW_COLUMN, + [column.fk_view_id], + `${CacheScope.GRID_VIEW_COLUMN}:${id}` + ); return this.get(id, ncMeta); }