npm @medusajs/medusa 1.10.0
v1.10.0

latest releases: 2.0.2-preview-20241113180231, 2.0.5-snapshot-20241113173305, 2.0.5-preview-20241113150158...
18 months ago

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"

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.

Chores

New Contributors

Full Changelog: v1.9.0...v1.10.0

Don't miss a new medusa release

NewReleases is sending notifications on new releases.