Repository navigation
fix(query-builder): resolve column lookup when using database column name in addOrderBy - #11904
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
commit: |
PR Code Suggestions ✨Latest suggestions up to bb4a81e
Previous suggestionsSuggestions
|
||||||||||||||||||
gioboa
left a comment
There was a problem hiding this comment.
Thanks @smith-xyz
The issue doesn't mention pagination so I'm wondering if it's a more generic problem. Can you create few tests for that?
most certainly! I was having troubles reproducing the issue at first with the code that was provided and noticed it was specifically in relation to pagination. But maybe there is another area that needs a similar handling. |
…name in addOrderBy with pagination
PR Code Suggestions ✨
|
|||||||||
|
cc @Simon3640 thanks for reporting that issue |
|
@gioboa added more tests to cover without pagination. This was working fine because that path has a safe check on column: Hope that helps, if any other improvements are needed will gladly adjust. |
|
your work is awesome guys ❤️ @gioboa @smith-xyz |
|
You can try this fix in preview with the generated package (few messages above) |
gioboa
left a comment
There was a problem hiding this comment.
LGTM @smith-xyz nice fix 👏
Code Review by Qodo
1. Missing documentation for database column name support
|
…name in addOrderBy (typeorm#11904)
Description of change
When using addOrderBy with a database column name (e.g., "p.created_at")
instead of the property name ("p.createdAt") combined with pagination
(skip/take), the query would crash with "Cannot read properties of
undefined (reading 'databaseName')".
The fix adds a fallback to findColumnWithDatabaseName when
findColumnWithPropertyPath doesn't find the column.
Fixes #11808
Pull-Request Checklist
masterbranchFixes #00000tests/**.test.ts)docs/docs/**.md)