Browse Source

fix(api): if cache(list) is not present skip pushing it into the list to avoid unexpected behaviour

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3569/head
Pranav C 2 years ago
parent
commit
7f7499b8fa
  1. 18
      packages/nocodb/src/lib/models/FormViewColumn.ts
  2. 18
      packages/nocodb/src/lib/models/GalleryViewColumn.ts
  3. 18
      packages/nocodb/src/lib/models/GridViewColumn.ts

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

@ -76,11 +76,19 @@ 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);
await NocoCache.appendToList( // if cache is not present skip pushing it into the list to avoid unexpected behaviour
CacheScope.FORM_VIEW_COLUMN, if (
[column.fk_view_id], (
`${CacheScope.FORM_VIEW_COLUMN}:${id}` await NocoCache.getList(CacheScope.FORM_VIEW_COLUMN, [
); column.fk_view_id,
])
)?.length
)
await NocoCache.appendToList(
CacheScope.FORM_VIEW_COLUMN,
[column.fk_view_id],
`${CacheScope.FORM_VIEW_COLUMN}:${id}`
);
return this.get(id, ncMeta); return this.get(id, ncMeta);
} }

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

@ -72,11 +72,19 @@ export default class GalleryViewColumn {
id id
); );
await NocoCache.appendToList( // if cache is not present skip pushing it into the list to avoid unexpected behaviour
CacheScope.GALLERY_VIEW_COLUMN, if (
[column.fk_view_id], (
`${CacheScope.GALLERY_VIEW_COLUMN}:${id}` await NocoCache.getList(CacheScope.GALLERY_VIEW_COLUMN, [
); column.fk_view_id,
])
)?.length
)
await NocoCache.appendToList(
CacheScope.GALLERY_VIEW_COLUMN,
[column.fk_view_id],
`${CacheScope.GALLERY_VIEW_COLUMN}:${id}`
);
return this.get(id, ncMeta); return this.get(id, ncMeta);
} }

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

@ -93,11 +93,19 @@ export default class GridViewColumn implements GridColumnType {
await NocoCache.set(`${CacheScope.GRID_VIEW_COLUMN}:${fk_column_id}`, id); await NocoCache.set(`${CacheScope.GRID_VIEW_COLUMN}:${fk_column_id}`, id);
await NocoCache.appendToList( // if cache is not present skip pushing it into the list to avoid unexpected behaviour
CacheScope.GRID_VIEW_COLUMN, if (
[column.fk_view_id], (
`${CacheScope.GRID_VIEW_COLUMN}:${id}` await NocoCache.getList(CacheScope.GRID_VIEW_COLUMN, [
); column.fk_view_id,
])
)?.length
)
await NocoCache.appendToList(
CacheScope.GRID_VIEW_COLUMN,
[column.fk_view_id],
`${CacheScope.GRID_VIEW_COLUMN}:${id}`
);
return this.get(id, ncMeta); return this.get(id, ncMeta);
} }

Loading…
Cancel
Save