Browse Source

fix: grouped filter api correction

re #2669

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2670/head
Pranav C 2 years ago
parent
commit
ab59d1e4dd
  1. 1
      packages/nocodb/src/lib/meta/api/filterApis.ts
  2. 15
      packages/nocodb/src/lib/models/Filter.ts

1
packages/nocodb/src/lib/meta/api/filterApis.ts

@ -49,7 +49,6 @@ export async function filterChildrenRead(
) {
try {
const filter = await Filter.parentFilterList({
viewId: req.params.viewId,
parentId: req.params.filterParentId,
});

15
packages/nocodb/src/lib/models/Filter.ts

@ -443,33 +443,24 @@ export default class Filter {
static async parentFilterList(
{
viewId,
parentId,
}: {
viewId: any;
parentId: any;
},
ncMeta = Noco.ncMeta
) {
let filterObjs = await NocoCache.getList(CacheScope.FILTER_EXP, [
viewId,
parentId,
]);
let filterObjs = await NocoCache.getList(CacheScope.FILTER_EXP, [parentId]);
if (!filterObjs.length) {
filterObjs = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, {
condition: {
fk_parent_id: parentId,
fk_view_id: viewId,
// fk_view_id: viewId,
},
orderBy: {
order: 'asc',
},
});
await NocoCache.setList(
CacheScope.FILTER_EXP,
[viewId, parentId],
filterObjs
);
await NocoCache.setList(CacheScope.FILTER_EXP, [parentId], filterObjs);
}
return filterObjs?.map((f) => new Filter(f));
}

Loading…
Cancel
Save