Browse Source

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

pull/5430/head
Wing-Kam Wong 2 years ago
parent
commit
fda8d67532
  1. 18
      packages/nocodb/src/lib/models/FormViewColumn.ts

18
packages/nocodb/src/lib/models/FormViewColumn.ts

@ -100,13 +100,11 @@ export default class FormViewColumn implements FormColumnType {
await NocoCache.set(`${CacheScope.FORM_VIEW_COLUMN}:${fk_column_id}`, id); await NocoCache.set(`${CacheScope.FORM_VIEW_COLUMN}:${fk_column_id}`, id);
// if cache is not present skip pushing it into the list to avoid unexpected behaviour // if cache is not present skip pushing it into the list to avoid unexpected behaviour
if ( const { list } = await NocoCache.getList(CacheScope.FORM_VIEW_COLUMN, [
( column.fk_view_id,
await NocoCache.getList(CacheScope.FORM_VIEW_COLUMN, [ ])
column.fk_view_id,
]) if (list.length)
)?.length
)
await NocoCache.appendToList( await NocoCache.appendToList(
CacheScope.FORM_VIEW_COLUMN, CacheScope.FORM_VIEW_COLUMN,
[column.fk_view_id], [column.fk_view_id],
@ -119,10 +117,12 @@ export default class FormViewColumn implements FormColumnType {
viewId: string, viewId: string,
ncMeta = Noco.ncMeta ncMeta = Noco.ncMeta
): Promise<FormViewColumn[]> { ): Promise<FormViewColumn[]> {
let viewColumns = await NocoCache.getList(CacheScope.FORM_VIEW_COLUMN, [ const cachedList = await NocoCache.getList(CacheScope.FORM_VIEW_COLUMN, [
viewId, viewId,
]); ]);
if (!viewColumns.length) { let { list: viewColumns } = cachedList;
const { isEmptyList } = cachedList;
if (!isEmptyList && !viewColumns.length) {
viewColumns = await ncMeta.metaList2( viewColumns = await ncMeta.metaList2(
null, null,
null, null,

Loading…
Cancel
Save