Highlights
Support outlet routes, loader, and handle
This release introduces support for
- exporting a loader from a route file
- exporting a handle from a route file
Here's an example using the loader and handle:
// src/admin/routes/articles/[id]/page.tsx
import { Button, Container, Heading } from "@medusajs/ui";
import { Link, LoaderFunctionArgs, Outlet, UIMatch, useLoaderData } from "react-router-dom";
export async function loader({ params }: LoaderFunctionArgs) {
const { id } = params;
return {
id,
};
}
export const handle = {
breadcrumb: (match: UIMatch<{ id: string }>) => {
const { id } = match.params;
return `#${id}`;
},
};
const ProfilePage = () => {
const { id } = useLoaderData() as Awaited<ReturnType<typeof loader>>;
return (
<div>
<Container className="flex justify-between items-center">
<Heading>Article {id}</Heading>
<Button size="small" variant="secondary" asChild>
<Link to="edit">Edit</Link>
</Button>
</Container>
{/* This will be used for the next example of an Outlet route */}
<Outlet />
</div>
);
};
export default ProfilePage;
In the above example we are passing data to the route from a loader, and defining a breadcrumb using the handle.
See more in #11305.
Expand options for instrumentation via registerOtel
This release expands the available options in our registerOtel
function from our instrumentation tooling. More specifically, the function will allow all options from OpenTelemetry's NodeSDK, which will open up support for a broader range of instrumentation tools, including Sentry.
Here's an example of configuring Sentry:
import Sentry from '@sentry/node'
import otelApi from "@opentelemetry/api";
import { registerOtel } from "@medusajs/medusa"
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc"
import { SentrySpanProcessor, SentryPropagator } from "@sentry/opentelemetry-node"
Sentry.init({
dsn: "<INSERT SENTRY DSN>",
tracesSampleRate: 1.0,
instrumenter: "otel",
});
otelApi.propagation.setGlobalPropagator(new SentryPropagator());
export function register() {
registerOtel({
serviceName: "medusa",
spanProcessor: new SentrySpanProcessor(),
traceExporter: new OTLPTraceExporter(),
instrument: {
http: true,
workflows: true,
query: true
},
})
}
See more in #11460.
Enrich and improve structural logging
This release improves structural logging by expanding the data with additional information, including request ID, request size, response size, request duration, and more.
Here's an example log line:
{"level":"http","client_ip":"10.18.85.250","request_id":"53123ef7-f8e9-4e85-8aea-3fecfc7d9ba0","http_version":"1.1","method":"POST","path":"/admin/products","status":200,"response_size":"10754","request_size":"1550","duration":1079.301,"referrer":"-","user_agent":"node","timestamp":"2025-02-24T08:36:17.748Z"}
See more in #11489.
Allow custom storage in JS-SDK
This release introduces support for a custom storage solution in the JS-SDK, instead of using the built-in memory
, session
, and local
. This allows you to pass a custom implementation of the storage interface to be responsible for token management.
See more in #11467.
What's Changed
Features
- feat: query.index by @carlos-r-l-rodrigues in #11348
- feat(dashboard,admin-vite-plugin): Add support for outlet routes, loader, and handle by @kasperkristensen in #11305
- feat: allow all NodeSDK options via registerOtel by @thetutlage in #11460
- feat(dashboard): Pickup option changes by @fPolic in #11306
- feat(): Backport metadata management by @adrien2p in #11469
- feat(ui,dashboard): Move InlineTip to UI package by @kasperkristensen in #11462
- feat: Add support for idempotency key in payments by @sradevski in #11494
- feat(framework): Improve production structured logging with more valuable information as well by @adrien2p in #11489
- feat(core-flows, dashboard, medusa, types): optional shipping profile by @fPolic in #11434
- feat: Add support to update account holder by @sradevski in #11499
- feat(medusa): Rollout index engine behind feature flag by @adrien2p in #11431
- feat(core-flows, types): add has missing inventory flag when listing shipping options by @fPolic in #11493
Bugs
- fix(dashboard): secret key display by @fPolic in #11365
- fix(utils): custom linkable keys by @carlos-r-l-rodrigues in #11400
- fix(admin-vite-plugin,admin-bundler,ui,icons,dashboard,framework,types): Update Vite dependencies by @kasperkristensen in #11414
- fix: Remove unnecessary swc production dependency by @sradevski in #11416
- fix(core-flows, types): reservation of shared inventory item by @fPolic in #11403
- fix(payment): update payment session data by @fPolic in #11410
- fix(medusa): Fix draft order validator, and endpoint by @kasperkristensen in #11398
- fix(design-system): singleton prompt by @fPolic in #11352
- fix: listVariantsList types by @thetutlage in #11441
- fix: relationships to accept ids by @thetutlage in #11399
- fix(medusa): Re throw error in instrumentation after reporting it by @adrien2p in #11464
- fix(medusa): Allow filtering by handle and title as arrays by @kasperkristensen in #11472
- fix(core-flows): Fix line item ids passed to deleteReservationsByLineItemsStep by @kasperkristensen in #11465
- fix(types): fix shipping profile type optional in create type / method by @shahednasser in #11453
- fix(dashboard): Fix size of buttons and use Link to navigate by @kasperkristensen in #11366
- fix: generate posix paths for migrations by @thetutlage in #11468
- fix(dashboard): Allow using the Enter key in product create Textarea by @kasperkristensen in #11488
- fix(dashboard): Properly delete metadata keys, and fix number parsing by @kasperkristensen in #11466
- fix(framework): add missing storefrontUrl from configuration type by @shahednasser in #11511
- fix(core-flows): add no_notification to fulfillment created event by @riqwan in #11507
- fix: allow setting DB_PORT and DATABASE_URL env variables by @thetutlage in #11519
- fix: typings for list payment method were incorrect by @sradevski in #11523
- fix(dashboard): Prevent overfetching data by @adrien2p in #11532
- fix(utils): Handle 0 correctly in build query by @olivermrbl in #11525
- fix(medusa,js-sdk,types): Add basic draft order operations to js-sdk by @kasperkristensen in #11514
- fix(): handle empty q filters - allow to query deleted records from graph API - staled_at fixes by @adrien2p in #11544
- fix(order): calculate taxes on order edit flows by @carlos-r-l-rodrigues in #11518
- fix(core-flows): Allow adding shipping methods through order edits by @kasperkristensen in #11504
- fix(js-sdk): Export Draft Order methods by @kasperkristensen in #11572
Documentation
- docs: update default for medusa start by @shahednasser in #11391
- docs: document payment changes + account holder by @shahednasser in #11242
- docs: add documentation for product <> shipping profile link by @shahednasser in #11397
- docs: general updates after 2.5.0 update by @shahednasser in #11402
- docs: added express checkout guide by @shahednasser in #10810
- docs: small fixes to workflow constraints chapter by @shahednasser in #11421
- docs: fix managing relationship for hasOne by @shahednasser in #11422
- docs: add section on validating module options by @shahednasser in #11427
- docs-util: fix inline code escape in generated references by @shahednasser in #11428
- docs: add section on middleware registration by @shahednasser in #11433
- docs: add section on pagination for query context by @shahednasser in #11432
- docs: Include
shipping_profile_id
in product creation request by @aceof10 in #11436 - docs: add missing shipping_profile_id in create product snippets by @shahednasser in #11443
- docs: fix link to troubleshooting by @shahednasser in #11448
- docs: fix digital products recipe by adding shipping profile to snippets by @shahednasser in #11452
- chore: improvements to provider docs by @shahednasser in #11451
- docs: add how to upload files in tests by @shahednasser in #11455
- docs: document configuring request body parsing by @shahednasser in #11463
- docs: update user guide introduction page by @shahednasser in #11474
- docs: update tips in user guide by @shahednasser in #11477
- docs: add array filter with comma in requests by @shahednasser in #11478
- docs: update orders user guide by @shahednasser in #11498
- docs: update products user guide by @shahednasser in #11506
- docs: update inventory user guide by @shahednasser in #11509
- docs: update customers user guide by @shahednasser in #11512
- docs: add sections on predefined environment and global variables by @shahednasser in #11510
- docs: add missing details in product import user guide by @shahednasser in #11527
- docs: update promotions user guide by @shahednasser in #11524
- docs: update price lists user guides by @shahednasser in #11528
- docs: update store user guide by @shahednasser in #11530
- docs: update users user guide by @shahednasser in #11531
- docs: many improvements to settings user guides by @shahednasser in #11536
- docs: fix typos + clarify example in UI docs by @shahednasser in #11543
- docs: fixes to wishlist plugin guide by @shahednasser in #11551
Chores
- chore(admin-sdk): Pin Zod version by @kasperkristensen in #11413
- chore(core-flows): update TSDocs of createProductsWorkflow by @shahednasser in #11439
- chore: add an action that generates documentation files in PRs by @shahednasser in #11423
- chore: fix the generate action by passing the token by @shahednasser in #11473
- chore: remove action to generate prep files for docs by @shahednasser in #11475
- Chore(index): Sync logs management by @adrien2p in #11522
- chore(cli): Prevent swallowing error in non production env by @adrien2p in #11534
- chore: Force select-in strategy by passing pagination through by @olivermrbl in #11556
Other Changes
- feat: added hook for createApiKeysWorkflow by @IgorKhomenko in #10909
- refactor(ui): rename folder for calendar components by @pnodet in #11369
- docs: Fix typos in productsCreated hook by @martinerko in #11276
- docs: fix incorrect path by @Ishrathh in #11435
- Update page.mdx by @saranshisatgit in #11459
- refactor: remove host from the server ready log by @thetutlage in #11485
- feat(js-sdk): implement custom storage config to support react native by @ranjithkumar8352 in #11467
- feat: Adding Bulgarian language to the admin dashboard. by @gbachev in #11565
New Contributors
- @martinerko made their first contribution in #11276
- @aceof10 made their first contribution in #11436
- @saranshisatgit made their first contribution in #11459
- @gbachev made their first contribution in #11565
Full Changelog: v2.5.0...v2.5.1