Skip to content

Conversation

@Smtih
Copy link
Contributor

@Smtih Smtih commented May 9, 2025

Fixes: #377

@TriPSs Can you let me know where you think a test for this case should live and I'll add something to the repo.

Thanks to @AngusLeck for working on this solution.

@nx-cloud
Copy link

nx-cloud bot commented May 9, 2025

View your CI Pipeline Execution ↗ for commit ec39883.

Command Status Duration Result
nx run-many --target=e2e --all ✅ Succeeded 2m 48s View ↗
nx run-many --target=test --all ✅ Succeeded 2m 25s View ↗
nx run-many --target=build --all ✅ Succeeded 13s View ↗
nx run-many --target=lint --all ✅ Succeeded 10s View ↗
nx run workspace:version ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2025-05-13 06:23:17 UTC

Comment on lines -342 to +349
return false
}
const nestedFilter = filter[field] as Filter<unknown>

if (!relation || relation.isOneToOne || relation.isManyToOne) {
return false
// } else if (relation.isOneToMany) {
// TODO
// return false
} else {
return true
}
}).length > 0
)
return this.shouldUseSkipTake(nestedFilter, relation.inverseEntityMetadata.relations)
})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a potential issue? What if the filter is flat, maybe we need to check if there is a nested filter?

Copy link
Contributor Author

@Smtih Smtih May 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the filter is flat I believe it would fall into the no relation case and exit above, we know this key represents a relational filter.
(I would also imagine this flat case is tested somewhere in the existing test suite and existing tests go green)

I think the easiest way to check on these would be to write the tests. Just point me at the best place to add something and maybe if we have tests with similar setups and I'll wrtie some up.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be here: packages/query-typeorm/__tests__/query/filter-query.builder.spec.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some tests.
Rebased the code to add tests, generate snapshots against the old code first.

See the diff after the change here: ec39883

If you'd like some more test cases describe them and let me know.

@Smtih Smtih force-pushed the fix/pagination-bug branch from 858256c to ec39883 Compare May 13, 2025 00:22
@Smtih Smtih requested a review from TriPSs May 13, 2025 05:29
@TriPSs
Copy link
Owner

TriPSs commented May 13, 2025

Thanks for the contribution!

@TriPSs TriPSs merged commit 649da64 into TriPSs:master May 13, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deep Filter Paging issue

2 participants