From 2bfbe127060c8490726f69852f8ecf163fd2b730 Mon Sep 17 00:00:00 2001 From: Tochukwu Date: Thu, 14 Nov 2024 11:21:21 +0100 Subject: [PATCH] fix: set meta of undefined error --- packages/nocodb-nest/src/models/View.ts | 6 ++++-- packages/nocodb/src/lib/models/View.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/nocodb-nest/src/models/View.ts b/packages/nocodb-nest/src/models/View.ts index 86abcae74342..058a30f723d7 100644 --- a/packages/nocodb-nest/src/models/View.ts +++ b/packages/nocodb-nest/src/models/View.ts @@ -126,8 +126,10 @@ export default class View implements ViewType { )); if (!view) { view = await ncMeta.metaGet2(null, null, MetaTable.VIEWS, viewId); - view.meta = parseMetaProp(view); - await NocoCache.set(`${CacheScope.VIEW}:${view.id}`, view); + if (view) { + view.meta = parseMetaProp(view); + await NocoCache.set(`${CacheScope.VIEW}:${view.id}`, view); + } } return view && new View(view); diff --git a/packages/nocodb/src/lib/models/View.ts b/packages/nocodb/src/lib/models/View.ts index 2f62091c4ff4..a63af8e7d8a8 100644 --- a/packages/nocodb/src/lib/models/View.ts +++ b/packages/nocodb/src/lib/models/View.ts @@ -126,8 +126,10 @@ export default class View implements ViewType { )); if (!view) { view = await ncMeta.metaGet2(null, null, MetaTable.VIEWS, viewId); - view.meta = parseMetaProp(view); - await NocoCache.set(`${CacheScope.VIEW}:${view.id}`, view); + if (view) { + view.meta = parseMetaProp(view); + await NocoCache.set(`${CacheScope.VIEW}:${view.id}`, view); + } } return view && new View(view);