Browse Source

fix: pagination bug fix

Signed-off-by: Pranav C <pranavxc@gmail.com>
test/query-opt-imp
Pranav C 2 years ago
parent
commit
e803ff6a54
  1. 5
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts
  2. 2
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts
  3. 1
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts

5
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -201,7 +201,8 @@ class BaseModelSqlv2 {
sort?: string | string[]; sort?: string | string[];
fieldsSet?: Set<string>; fieldsSet?: Set<string>;
} = {}, } = {},
ignoreViewFilterAndSort = false ignoreViewFilterAndSort = false,
): Promise<any> { ): Promise<any> {
const { where, fields, ...rest } = this._getListArgs(args as any); const { where, fields, ...rest } = this._getListArgs(args as any);
@ -286,6 +287,8 @@ class BaseModelSqlv2 {
if (!ignoreViewFilterAndSort) applyPaginate(innerQb, rest); if (!ignoreViewFilterAndSort) applyPaginate(innerQb, rest);
const proto = await this.getProto(); const proto = await this.getProto();
console.log(wrapperQb.toQuery())
const data = await this.execAndParse(wrapperQb); const data = await this.execAndParse(wrapperQb);
return data?.map((d) => { return data?.map((d) => {

2
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts

@ -821,7 +821,7 @@ export default async function formulaQueryBuilderv2(
model: Model, model: Model,
column?: Column, column?: Column,
aliasToColumn = {}, aliasToColumn = {},
tableAlias?: string tableAlias?: string,
) { ) {
// register jsep curly hook once only // register jsep curly hook once only
jsep.plugins.register(jsepCurlyHook); jsep.plugins.register(jsepCurlyHook);

1
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts

@ -14,6 +14,7 @@ const getAst = async ({
model, model,
view, view,
dependencyFields = { dependencyFields = {
...(query || {}),
nested: { ...(query?.nested || {}) }, nested: { ...(query?.nested || {}) },
fieldsSet: new Set(), fieldsSet: new Set(),
}, },

Loading…
Cancel
Save