Browse Source

fix: check view/id defined or not before getting sort list based on viewId

pull/6941/head
Pranav C 1 year ago
parent
commit
2792f68eaa
  1. 11
      packages/nocodb/src/db/BaseModelSqlv2.ts

11
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -657,10 +657,13 @@ class BaseModelSqlv2 {
qb,
);
if (!sorts)
sorts = args.sortArr?.length
? args.sortArr
: await Sort.list({ viewId: this.viewId });
if (!sorts) {
if (args.sortArr?.length) {
sorts = args.sortArr;
} else if (this.viewId) {
sorts = await Sort.list({ viewId: this.viewId });
}
}
// if sort is provided filter out the group by columns sort and apply
// since we are grouping by the column and applying sort on any other column is not required

Loading…
Cancel
Save