Browse Source

fix: reset column list cache after column update

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/6030/head
Pranav C 1 year ago
parent
commit
f4e6874ac6
  1. 24
      packages/nocodb/src/models/Column.ts

24
packages/nocodb/src/models/Column.ts

@ -1075,6 +1075,30 @@ export default class Column<T = any> implements ColumnType {
// set cache // set cache
await NocoCache.set(key, o); await NocoCache.set(key, o);
} }
// get model column list from cache
const columnListFromCache = await NocoCache.getList(CacheScope.COLUMN, [
oldCol.fk_model_id,
]);
// update column list in cache if cache exists
if (!columnListFromCache.list?.length) {
const updatedColumnList = columnListFromCache.list.map((column: any) => {
if (column.id === colId) {
return {
...column,
...updateObj,
};
}
return column;
});
await NocoCache.setList(
CacheScope.COLUMN,
[oldCol.fk_model_id],
updatedColumnList,
);
}
// set meta // set meta
await ncMeta.metaUpdate( await ncMeta.metaUpdate(
null, null,

Loading…
Cancel
Save