Skip to content

v1.10.0

Compare
Choose a tag to compare
@olivermrbl olivermrbl released this 04 May 08:56
· 2283 commits to develop since this release

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