mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Process page only when merging with parent items (#16010)
This commit is contained in:
@@ -97,7 +97,11 @@ export default async function runAST(
|
||||
|
||||
while (hasMore) {
|
||||
const node = merge({}, nestedNode, {
|
||||
query: { limit: env.RELATIONAL_BATCH_SIZE, offset: batchCount * env.RELATIONAL_BATCH_SIZE },
|
||||
query: {
|
||||
limit: env.RELATIONAL_BATCH_SIZE,
|
||||
offset: batchCount * env.RELATIONAL_BATCH_SIZE,
|
||||
page: null,
|
||||
},
|
||||
});
|
||||
|
||||
nestedItems = (await runAST(node, schema, { knex, nested: true })) as Item[] | null;
|
||||
@@ -350,6 +354,12 @@ function mergeWithParentItems(
|
||||
|
||||
parentItem[nestedNode.fieldKey].push(...itemChildren);
|
||||
|
||||
if (nestedNode.query.page && nestedNode.query.page > 1) {
|
||||
parentItem[nestedNode.fieldKey] = parentItem[nestedNode.fieldKey].slice(
|
||||
(nestedNode.query.limit ?? 100) * (nestedNode.query.page - 1)
|
||||
);
|
||||
}
|
||||
|
||||
if (nestedNode.query.offset && nestedNode.query.offset >= 0) {
|
||||
parentItem[nestedNode.fieldKey] = parentItem[nestedNode.fieldKey].slice(nestedNode.query.offset);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user