From 132c2b98927939720288e8d980877ee175614819 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 7 Jun 2023 12:42:23 +0530 Subject: [PATCH] fix: reset alias cache on view rename Signed-off-by: Pranav C --- packages/nocodb/src/models/View.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/nocodb/src/models/View.ts b/packages/nocodb/src/models/View.ts index 86abcae743..0b9e26cce6 100644 --- a/packages/nocodb/src/models/View.ts +++ b/packages/nocodb/src/models/View.ts @@ -1,3 +1,4 @@ +import { title } from 'process'; import { isSystemColumn, UITypes, ViewTypes } from 'nocodb-sdk'; import Noco from '../Noco'; import { @@ -952,6 +953,7 @@ export default class View implements ViewType { // get existing cache const key = `${CacheScope.VIEW}:${viewId}`; let o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT); + let oldView = { ...o }; if (o) { // update data o = { @@ -963,8 +965,13 @@ export default class View implements ViewType { } // set cache await NocoCache.set(key, o); + } else { + oldView = await this.get(viewId); } + // reset alias cache + await NocoCache.del(`${CacheScope.VIEW}:${oldView.fk_model_id}:${oldView.title}`); + // if meta data defined then stringify it if ('meta' in updateObj) { updateObj.meta = stringifyMetaProp(updateObj);