Skip to content

fix(admin): Handle deleted stock locations gracefully in order details#14686

Open
SBALAVIGNESH123 wants to merge 3 commits intomedusajs:developfrom
SBALAVIGNESH123:fix/admin-dashboard-crash
Open

fix(admin): Handle deleted stock locations gracefully in order details#14686
SBALAVIGNESH123 wants to merge 3 commits intomedusajs:developfrom
SBALAVIGNESH123:fix/admin-dashboard-crash

Conversation

@SBALAVIGNESH123
Copy link

@SBALAVIGNESH123 SBALAVIGNESH123 commented Feb 2, 2026

Fixes #14672

Description
The order details page was crashing when an order's fulfillment referenced a deleted stock location. The useStockLocation hook would return an error (404), which was being explicitly thrown by the component, causing the React error boundary to trigger.

This PR handles the error state gracefully by:

  1. Removing the explicit hrow error.
  2. Displaying a 'Location deleted' placeholder when isError is true.
    How to verify
  3. Create a stock location and fulfill an order from it.
  4. Delete the stock location.
  5. Open order details.
  6. Verify the page no longer crashes and shows 'Location deleted'.

Note

Low Risk
Low risk UI change: removes a thrown error and adds an explicit error placeholder when a fulfillment’s stock location lookup returns 404, preventing an order details crash.

Overview
Prevents the order details fulfillment section from crashing when useStockLocation fails (e.g., deleted/404 locations) by removing the explicit throw error path and rendering a muted “Location deleted” placeholder instead of triggering the error boundary.

Adds a patch changeset for @medusajs/dashboard documenting the fix.

Written by Cursor Bugbot for commit 4f6f3ff. This will update automatically on new commits. Configure here.

@SBALAVIGNESH123 SBALAVIGNESH123 requested a review from a team as a code owner February 2, 2026 13:50
@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2026

🦋 Changeset detected

Latest commit: 4f6f3ff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 76 packages
Name Type
@medusajs/dashboard Patch
@medusajs/admin-bundler Patch
@medusajs/medusa Patch
@medusajs/test-utils Patch
@medusajs/medusa-oas-cli Patch
integration-tests-http Patch
@medusajs/analytics Patch
@medusajs/api-key Patch
@medusajs/auth Patch
@medusajs/caching Patch
@medusajs/cart Patch
@medusajs/currency Patch
@medusajs/customer Patch
@medusajs/file Patch
@medusajs/fulfillment Patch
@medusajs/index Patch
@medusajs/inventory Patch
@medusajs/link-modules Patch
@medusajs/locking Patch
@medusajs/notification Patch
@medusajs/order Patch
@medusajs/payment Patch
@medusajs/pricing Patch
@medusajs/product Patch
@medusajs/promotion Patch
@medusajs/rbac Patch
@medusajs/region Patch
@medusajs/sales-channel Patch
@medusajs/settings Patch
@medusajs/stock-location Patch
@medusajs/store Patch
@medusajs/tax Patch
@medusajs/translation Patch
@medusajs/user Patch
@medusajs/workflow-engine-inmemory Patch
@medusajs/workflow-engine-redis Patch
@medusajs/draft-order Patch
@medusajs/oas-github-ci Patch
@medusajs/cache-inmemory Patch
@medusajs/cache-redis Patch
@medusajs/event-bus-local Patch
@medusajs/event-bus-redis Patch
@medusajs/analytics-local Patch
@medusajs/analytics-posthog Patch
@medusajs/auth-emailpass Patch
@medusajs/auth-github Patch
@medusajs/auth-google Patch
@medusajs/caching-redis Patch
@medusajs/file-local Patch
@medusajs/file-s3 Patch
@medusajs/fulfillment-manual Patch
@medusajs/locking-postgres Patch
@medusajs/locking-redis Patch
@medusajs/notification-local Patch
@medusajs/notification-sendgrid Patch
@medusajs/payment-stripe Patch
@medusajs/core-flows Patch
@medusajs/framework Patch
@medusajs/js-sdk Patch
@medusajs/modules-sdk Patch
@medusajs/orchestration Patch
@medusajs/types Patch
@medusajs/utils Patch
@medusajs/workflows-sdk Patch
@medusajs/cli Patch
@medusajs/deps Patch
@medusajs/telemetry Patch
@medusajs/admin-sdk Patch
@medusajs/admin-shared Patch
@medusajs/admin-vite-plugin Patch
@medusajs/icons Patch
@medusajs/toolbox Patch
@medusajs/ui-preset Patch
create-medusa-app Patch
medusa-dev-cli Patch
@medusajs/ui Patch

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

@vercel
Copy link

vercel bot commented Feb 2, 2026

@SBALAVIGNESH123 is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

</Link>
) : isError ? (
<Text size="small" leading="compact" className="text-ui-fg-muted italic">
Location deleted
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded string bypasses i18n translation system

Medium Severity

The string "Location deleted" is hardcoded in English while the rest of the component uses t() from useTranslation for all user-facing text. Non-English users will see this text in English while everything else in the UI is translated, creating an inconsistent experience. The text needs to use the translation function like other strings in the component.

Fix in Cursor Fix in Web

) : isError ? (
<Text size="small" leading="compact" className="text-ui-fg-muted italic">
Location deleted
</Text>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All API errors incorrectly displayed as deleted location

Low Severity

The code treats all isError states as "Location deleted", but the error object (which is destructured but unused) could indicate other failure types like network errors, server errors (500), or permission issues (403). Users would see "Location deleted" even when the location exists but is temporarily unreachable, which is misleading.

Fix in Cursor Fix in Web

FulfillmentSetType.Pickup

const { stock_location, isError, error } = useStockLocation(
const { stock_location, isError, error, isLoading } = useStockLocation(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable isLoading destructured but never used

Low Severity

The isLoading variable is destructured from useStockLocation but is never used anywhere in the Fulfillment component. It was added in this PR but serves no purpose since the loading state is implicitly handled by rendering the Skeleton when stock_location is falsy.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Admin dashboard crashes when viewing orders with fulfillments referencing deleted stock locations

1 participant