Skip to content

Commit

Permalink
fix: other empty result responses (#1915)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr authored Mar 28, 2024
1 parent 301f9a1 commit 3cd2c64
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/datastore/pg-store-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,11 @@ export class PgStoreV2 extends BasePgStoreModule {
LIMIT ${limit}
OFFSET ${offset}
`;
const blocks = blocksQuery.map(r => r);
return {
limit,
offset,
results: blocks,
total: blocks[0].total,
results: blocksQuery,
total: blocksQuery.count > 0 ? blocksQuery[0].total : 0,
};
});
}
Expand Down Expand Up @@ -534,7 +533,7 @@ export class PgStoreV2 extends BasePgStoreModule {
limit,
offset,
results: results,
total: results[0].total,
total: results.count > 0 ? results[0].total : 0,
};
});
}
Expand Down Expand Up @@ -597,7 +596,7 @@ export class PgStoreV2 extends BasePgStoreModule {
limit,
offset,
results: results,
total: results[0].total,
total: results.count > 0 ? results[0].total : 0,
};
});
}
Expand Down

0 comments on commit 3cd2c64

Please sign in to comment.