-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix(dashboard,medusa,types): improve performance for price list prices retrieval #14138
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
base: develop
Are you sure you want to change the base?
Conversation
…d remove remoteQuery from name
🦋 Changeset detectedLatest commit: cee8da7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 74 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 8 Skipped Deployments
|
|
/snapshot-this |
🚀 A snapshot release has been made for this PRTest the snapshots by updating your yarn add @medusajs/admin-bundler@3.0.0-snapshot-20251126221441yarn add @medusajs/admin-sdk@3.0.0-snapshot-20251126221441yarn add @medusajs/admin-shared@3.0.0-snapshot-20251126221441yarn add @medusajs/admin-vite-plugin@3.0.0-snapshot-20251126221441yarn add @medusajs/dashboard@3.0.0-snapshot-20251126221441yarn add create-medusa-app@3.0.0-snapshot-20251126221441yarn add @medusajs/cli@3.0.0-snapshot-20251126221441yarn add medusa-dev-cli@3.0.0-snapshot-20251126221441yarn add @medusajs/medusa-oas-cli@3.0.0-snapshot-20251126221441yarn add @medusajs/core-flows@3.0.0-snapshot-20251126221441yarn add @medusajs/framework@3.0.0-snapshot-20251126221441yarn add @medusajs/js-sdk@3.0.0-snapshot-20251126221441yarn add @medusajs/modules-sdk@3.0.0-snapshot-20251126221441yarn add @medusajs/orchestration@3.0.0-snapshot-20251126221441yarn add @medusajs/types@3.0.0-snapshot-20251126221441yarn add @medusajs/utils@3.0.0-snapshot-20251126221441yarn add @medusajs/workflows-sdk@3.0.0-snapshot-20251126221441yarn add @medusajs/deps@3.0.0-snapshot-20251126221441yarn add @medusajs/icons@3.0.0-snapshot-20251126221441yarn add @medusajs/ui@4.0.28-snapshot-20251126221441yarn add @medusajs/ui-preset@3.0.0-snapshot-20251126221441yarn add @medusajs/medusa@3.0.0-snapshot-20251126221441yarn add @medusajs/telemetry@3.0.0-snapshot-20251126221441yarn add @medusajs/test-utils@3.0.0-snapshot-20251126221441yarn add @medusajs/analytics@3.0.0-snapshot-20251126221441yarn add @medusajs/api-key@3.0.0-snapshot-20251126221441yarn add @medusajs/auth@3.0.0-snapshot-20251126221441yarn add @medusajs/cache-inmemory@3.0.0-snapshot-20251126221441yarn add @medusajs/cache-redis@3.0.0-snapshot-20251126221441yarn add @medusajs/caching@3.0.0-snapshot-20251126221441yarn add @medusajs/cart@3.0.0-snapshot-20251126221441yarn add @medusajs/currency@3.0.0-snapshot-20251126221441yarn add @medusajs/customer@3.0.0-snapshot-20251126221441yarn add @medusajs/event-bus-local@3.0.0-snapshot-20251126221441yarn add @medusajs/event-bus-redis@3.0.0-snapshot-20251126221441yarn add @medusajs/file@3.0.0-snapshot-20251126221441yarn add @medusajs/fulfillment@3.0.0-snapshot-20251126221441yarn add @medusajs/index@3.0.0-snapshot-20251126221441yarn add @medusajs/inventory@3.0.0-snapshot-20251126221441yarn add @medusajs/link-modules@3.0.0-snapshot-20251126221441yarn add @medusajs/locking@3.0.0-snapshot-20251126221441yarn add @medusajs/notification@3.0.0-snapshot-20251126221441yarn add @medusajs/order@3.0.0-snapshot-20251126221441yarn add @medusajs/payment@3.0.0-snapshot-20251126221441yarn add @medusajs/pricing@3.0.0-snapshot-20251126221441yarn add @medusajs/product@3.0.0-snapshot-20251126221441yarn add @medusajs/promotion@3.0.0-snapshot-20251126221441yarn add @medusajs/analytics-local@3.0.0-snapshot-20251126221441yarn add @medusajs/analytics-posthog@3.0.0-snapshot-20251126221441yarn add @medusajs/auth-emailpass@3.0.0-snapshot-20251126221441yarn add @medusajs/auth-github@3.0.0-snapshot-20251126221441yarn add @medusajs/auth-google@3.0.0-snapshot-20251126221441yarn add @medusajs/caching-redis@3.0.0-snapshot-20251126221441yarn add @medusajs/file-local@3.0.0-snapshot-20251126221441yarn add @medusajs/file-s3@3.0.0-snapshot-20251126221441yarn add @medusajs/fulfillment-manual@3.0.0-snapshot-20251126221441yarn add @medusajs/locking-postgres@3.0.0-snapshot-20251126221441yarn add @medusajs/locking-redis@3.0.0-snapshot-20251126221441yarn add @medusajs/notification-local@3.0.0-snapshot-20251126221441yarn add @medusajs/notification-sendgrid@3.0.0-snapshot-20251126221441yarn add @medusajs/payment-stripe@3.0.0-snapshot-20251126221441yarn add @medusajs/region@3.0.0-snapshot-20251126221441yarn add @medusajs/sales-channel@3.0.0-snapshot-20251126221441yarn add @medusajs/settings@3.0.0-snapshot-20251126221441yarn add @medusajs/stock-location@3.0.0-snapshot-20251126221441yarn add @medusajs/store@3.0.0-snapshot-20251126221441yarn add @medusajs/tax@3.0.0-snapshot-20251126221441yarn add @medusajs/user@3.0.0-snapshot-20251126221441yarn add @medusajs/workflow-engine-inmemory@3.0.0-snapshot-20251126221441yarn add @medusajs/workflow-engine-redis@3.0.0-snapshot-20251126221441yarn add @medusajs/draft-order@3.0.0-snapshot-20251126221441
|
|
@olivermrbl would using the changeset experimental flag |
Summary
What — What changes are introduced in this PR?
Price lists prices didn't have a dedicated method to query them and instead, relied on being returned as part of price lists. This, however, introduces optimization issues that for price lists with many prices, could cause crashes. The reason being that relations are not paginated and thus, all prices linked to the price list would be returned.
This PR aims to solve this by introducing a dedicated endpoint and avoiding returning the
pricesas part of price lists by default. The idea being that it is up to the user to explicitly express this, which, for small price lists no issues will arise, but for bigger ones, they will easily recognize the performance impact.Why — Why are these changes relevant or necessary?
Users with large enough price lists would have serious performance issues or even crashes when querying the
/admin/price-listsendpoints. This is also true when navigating to the price list section of the Admin UI since it queries this same endpoints.How — How have these changes been implemented?
pricesrelation to be part of the default fields returned by the/admin/price-lists/endpoints. User may still request it by passing it infieldsquery param./admin/price-lists/[id]/pricesGET endpoint to be able to retrieve a price list prices with pagination.Testing — How have these changes been tested, or how can the reviewer test the feature?
Integration tests.
Examples
Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.
This helps with documentation and ensures maintainers can quickly understand and verify the change.
// Example usageChecklist
Please ensure the following before requesting a review:
yarn changesetand follow the promptsAdditional Context
The current state of the PR fixes the issue on the price list list and detail component. It still doesn't solve the issue for the following screens: Edit Prices & Add Prices
All the prices are still retrieved from the
/admin/price-lists/endpoint for these. I want first some feedback before changing it to the new endpoint, since the current DataGrid implementation doesn't support pagination and it seems we are passing a default limit for the products to show there, an arbitrarily large number 9999 and there is also a TODO comment of changing that.This previous point, though, could be implemented in a later PR, so we can already fix the issue in the price list list and detail pages, so at least for large price lists these screens don't explode and smaller price lists can still have its product prices edited, while only large ones will explode when trying to perform this action. @adrien2p @fPolic thoughts?
closes ENTSUP-265, CORE-1239