-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
fix(medusa): Query Config update Order By filter #12781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
8 Skipped Deployments
|
f8e8339
to
c2c15bd
Compare
f6c410d
to
a37ff05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, do you know why the yarn lock changed?
**What** Fixed a bug in the prepareListQuery function where nested field ordering was not properly building the expected nested object structure. The function was returning flat objects like { "employee.first_name": "ASC" } instead of the correct nested structure { "employee": { "first_name": "ASC" } }. **Why** The buildOrder function is designed to create nested objects from dot-notation field paths, which is essential for proper query building in the Medusa framework. When this functionality was broken, it prevented correct ordering of related fields and caused queries to fail or return unexpected results. **How** - Root cause: The prepareListQuery function was not properly utilizing the buildOrder utility function to transform dot-notation field paths into nested objects - Before: order = "employee.first_name" → { "employee.first_name": "ASC" } - After: order = "employee.first_name" → { "employee": { "first_name": "ASC" } } - Added comprehensive tests: Created detailed unit tests for the prepareListQuery function focusing on buildOrder functionality, covering various scenarios including: - Simple ascending/descending order - Nested field ordering (e.g., product.title) - Deeply nested ordering (e.g., product.variants.prices.amount) - Multiple nesting levels (up to 5 levels deep) - Added integration tests: Created integration tests in product.spec.ts to verify the full end-to-end functionality of nested ordering with variant titles The fix ensures that the buildOrder function properly transforms dot-notation field paths into the expected nested object structure, enabling correct query building for related field ordering throughout the Medusa framework. Resolves SUP-1868
797b019
to
861bfb7
Compare
@adrien2p increased the following package version:
Since there was a mismatch with another dependency |
/snapshot-this |
2 similar comments
/snapshot-this |
/snapshot-this |
🚀 A snapshot release has been made for this PRTest the snapshots by updating your yarn add @medusajs/admin-bundler@2.8.5-snapshot-20250620191520 yarn add @medusajs/admin-sdk@2.8.5-snapshot-20250620191520 yarn add @medusajs/admin-shared@2.8.5-snapshot-20250620191520 yarn add @medusajs/admin-vite-plugin@2.8.5-snapshot-20250620191520 yarn add @medusajs/dashboard@2.8.5-snapshot-20250620191520 yarn add create-medusa-app@2.8.5-snapshot-20250620191520 yarn add @medusajs/cli@2.8.5-snapshot-20250620191520 yarn add medusa-dev-cli@2.8.5-snapshot-20250620191520 yarn add @medusajs/medusa-oas-cli@2.8.5-snapshot-20250620191520 yarn add @medusajs/core-flows@2.8.5-snapshot-20250620191520 yarn add @medusajs/framework@2.8.5-snapshot-20250620191520 yarn add @medusajs/js-sdk@2.8.5-snapshot-20250620191520 yarn add @medusajs/modules-sdk@2.8.5-snapshot-20250620191520 yarn add @medusajs/orchestration@2.8.5-snapshot-20250620191520 yarn add @medusajs/types@2.8.5-snapshot-20250620191520 yarn add @medusajs/utils@2.8.5-snapshot-20250620191520 yarn add @medusajs/workflows-sdk@2.8.5-snapshot-20250620191520 yarn add @medusajs/icons@2.8.5-snapshot-20250620191520 yarn add @medusajs/ui@4.0.15-snapshot-20250620191520 yarn add @medusajs/ui-preset@2.8.5-snapshot-20250620191520 yarn add @medusajs/medusa@2.8.5-snapshot-20250620191520 yarn add @medusajs/telemetry@2.8.5-snapshot-20250620191520 yarn add @medusajs/test-utils@2.8.5-snapshot-20250620191520 yarn add @medusajs/analytics@2.8.5-snapshot-20250620191520 yarn add @medusajs/api-key@2.8.5-snapshot-20250620191520 yarn add @medusajs/auth@2.8.5-snapshot-20250620191520 yarn add @medusajs/cache-inmemory@2.8.5-snapshot-20250620191520 yarn add @medusajs/cache-redis@2.8.5-snapshot-20250620191520 yarn add @medusajs/cart@2.8.5-snapshot-20250620191520 yarn add @medusajs/currency@2.8.5-snapshot-20250620191520 yarn add @medusajs/customer@2.8.5-snapshot-20250620191520 yarn add @medusajs/event-bus-local@2.8.5-snapshot-20250620191520 yarn add @medusajs/event-bus-redis@2.8.5-snapshot-20250620191520 yarn add @medusajs/file@2.8.5-snapshot-20250620191520 yarn add @medusajs/fulfillment@2.8.5-snapshot-20250620191520 yarn add @medusajs/index@2.8.5-snapshot-20250620191520 yarn add @medusajs/inventory@2.8.5-snapshot-20250620191520 yarn add @medusajs/link-modules@2.8.5-snapshot-20250620191520 yarn add @medusajs/locking@2.8.5-snapshot-20250620191520 yarn add @medusajs/notification@2.8.5-snapshot-20250620191520 yarn add @medusajs/order@2.8.5-snapshot-20250620191520 yarn add @medusajs/payment@2.8.5-snapshot-20250620191520 yarn add @medusajs/pricing@2.8.5-snapshot-20250620191520 yarn add @medusajs/product@2.8.5-snapshot-20250620191520 yarn add @medusajs/promotion@2.8.5-snapshot-20250620191520 yarn add @medusajs/analytics-local@2.8.5-snapshot-20250620191520 yarn add @medusajs/analytics-posthog@2.8.5-snapshot-20250620191520 yarn add @medusajs/auth-emailpass@2.8.5-snapshot-20250620191520 yarn add @medusajs/auth-github@2.8.5-snapshot-20250620191520 yarn add @medusajs/auth-google@2.8.5-snapshot-20250620191520 yarn add @medusajs/file-local@2.8.5-snapshot-20250620191520 yarn add @medusajs/file-s3@2.8.5-snapshot-20250620191520 yarn add @medusajs/fulfillment-manual@2.8.5-snapshot-20250620191520 yarn add @medusajs/locking-postgres@2.8.5-snapshot-20250620191520 yarn add @medusajs/locking-redis@2.8.5-snapshot-20250620191520 yarn add @medusajs/notification-local@2.8.5-snapshot-20250620191520 yarn add @medusajs/notification-sendgrid@2.8.5-snapshot-20250620191520 yarn add @medusajs/payment-stripe@2.8.5-snapshot-20250620191520 yarn add @medusajs/region@2.8.5-snapshot-20250620191520 yarn add @medusajs/sales-channel@2.8.5-snapshot-20250620191520 yarn add @medusajs/stock-location@2.8.5-snapshot-20250620191520 yarn add @medusajs/store@2.8.5-snapshot-20250620191520 yarn add @medusajs/tax@2.8.5-snapshot-20250620191520 yarn add @medusajs/user@2.8.5-snapshot-20250620191520 yarn add @medusajs/workflow-engine-inmemory@2.8.5-snapshot-20250620191520 yarn add @medusajs/workflow-engine-redis@2.8.5-snapshot-20250620191520
|
What
Fixed a bug in the prepareListQuery function where nested field ordering was not properly building the expected nested object structure. The function was returning flat objects like { "employee.first_name": "ASC" } instead of the correct nested structure { "employee": { "first_name": "ASC" } }.
Why
The buildOrder function is designed to create nested objects from dot-notation field paths, which is essential for proper query building in the Medusa framework. When this functionality was broken, it prevented correct ordering of related fields and caused queries to fail or return unexpected results.
How
prepareListQuery
function was not properly utilizing thebuildOrder
utility function to transform dot-notation field paths into nested objectsproduct.spec.ts
to verify the full end-to-end functionality of nested ordering with variant titlesThe fix ensures that the buildOrder function properly transforms dot-notation field paths into the expected nested object structure, enabling correct query building for related field ordering throughout the Medusa framework.
Resolves SUP-1868