Browse Source

refactor(nocodb): adopt getList new format in Model.ts

pull/5430/head
Wing-Kam Wong 2 years ago
parent
commit
ad8f5cfef2
  1. 11
      packages/nocodb/src/lib/models/Model.ts

11
packages/nocodb/src/lib/models/Model.ts

@ -162,7 +162,10 @@ export default class Model implements TableType {
): Promise<Model[]> { ): Promise<Model[]> {
let cachedList; let cachedList;
if (base_id) { if (base_id) {
cachedList = await NocoCache.getList(CacheScope.MODEL, [project_id, base_id]); cachedList = await NocoCache.getList(CacheScope.MODEL, [
project_id,
base_id,
]);
} else { } else {
cachedList = await NocoCache.getList(CacheScope.MODEL, [project_id]); cachedList = await NocoCache.getList(CacheScope.MODEL, [project_id]);
} }
@ -213,11 +216,13 @@ export default class Model implements TableType {
}, },
ncMeta = Noco.ncMeta ncMeta = Noco.ncMeta
): Promise<Model[]> { ): Promise<Model[]> {
let modelList = await NocoCache.getList(CacheScope.MODEL, [ const cachedList = await NocoCache.getList(CacheScope.MODEL, [
project_id, project_id,
db_alias, db_alias,
]); ]);
if (!modelList.length) { let { list: modelList } = cachedList;
const { isEmptyList } = cachedList;
if (!isEmptyList && !modelList.length) {
modelList = await ncMeta.metaList2( modelList = await ncMeta.metaList2(
project_id, project_id,
db_alias, db_alias,

Loading…
Cancel
Save