v1.10.0
Breaking changes
Performance improvements
To improve performance of Cart and Product retrieval, we've changed the relationLoadStrategy
in Typeorm from join
to query
. This means relations are loaded using separate database queries rather than many joins in a single large query. This change also significantly reduces memory usage, as it will produce a much smaller result.
Unfortunately, Typeorm's query
-strategy does not work well in concert with transactions, which is extensively used across our codebase. The separate queries to fetch relations on entities will run outside of an initiated transaction, because it uses a different query runner. This leads to incorrect results in cases where you request entities previously created in an ongoing transaction. Those changes will not have persisted to the database at the time of querying, and will therefore be "invisible" to other query runners.
Instead of compromising on the performance of our API, we decided to fix the issue in Typeorm, which can be found in this PR. It is still yet to be merged, so for now, we have published a forked version of Typeorm that includes the fix. This is the breaking change of this release.
To make sure your project works as expected, you will need to use our forked version in your project until Typeorm accepts our PR and publishes a new version.
In your package.json
, replace the Typeorm version with the following:
"typeorm": "npm:@medusajs/typeorm@next"
Features
Listing products
In #4010, we've introduced checks in our Product API ensuring that product pricing and availability are only set if they are requested.
The impacted endpoints are:
GET /store/products
GET /store/products/:id
GET /admin/products
GET /admin/products/:id
By default, these properties will be set on the product and product variants, but if you specify the expand
query param on your request, you might not receive product pricing and availability. To include those, add variants and variant prices to the expand
. It will look like this:
GET /store/products?expand="variants,variants.prices"
- feat(admin-ui): Metadata for stock locations by @pKorsholm in #3955
- feat(medusa): Create-swap with sales channel by @pKorsholm in #3998
Bugs
Event Bus
In v1.9.0, we changed the events system to only fire an event if it had any subscribers. This spawned a bug around wildcard subscribers that we missed in our testing. Wildcard subscribers are supposed to run on all events and are created like so:
eventBusService.subscribe("*", someMethodToHandleEvent)
To make up for this mistake, we've rolled back the changes introduced in 1.9.0 and will go back to the drawing board at some point in the future.
- fix(medusa): products retrieve uses query strategy for performance by @riqwan in #3926
- fix(medusa): Use query relation load strategy on Carts by @olivermrbl in #3984
- fix(medusa): Performance improvement for variant availability by @pKorsholm in #3921
- fix(medusa): Broken payment session migration by @rajshrimohanks in #3098
- fix(admin-ui): allocated badge for orders with statuses cancelled and archived by @pKorsholm in #3950
- fix(admin-ui): Navigating to tax settings should not break URL by @kasperkristensen in #3989
- fix(admin-ui): Pin react-router-dom by @kasperkristensen in #3999
- fix(medusa, types, utils, event-bus-local): Revert retrieveSubscribers by @adrien2p in #4002
- fix(medusa): Only set product availability + prices if requested by @olivermrbl in https://github.com/medusajs/medusa/pull/#4010
Chores
- chore: Bump Typeorm to Medusa fork by @olivermrbl in #3981
New Contributors
- @rajshrimohanks made their first contribution in #3098
- @vladimirpekez made their first contribution in #3972
- @karti16 made their first contribution in #3977
Full Changelog: v1.9.0...v1.10.0