fix(admin): Handle deleted stock locations gracefully in order details#14686
fix(admin): Handle deleted stock locations gracefully in order details#14686SBALAVIGNESH123 wants to merge 3 commits intomedusajs:developfrom
Conversation
🦋 Changeset detectedLatest commit: 4f6f3ff The changes in this PR will be included in the next version bump. This PR includes changesets to release 76 packages
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 |
|
@SBALAVIGNESH123 is attempting to deploy a commit to the medusajs Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
| ) : isError ? ( | ||
| <Text size="small" leading="compact" className="text-ui-fg-muted italic"> | ||
| Location deleted | ||
| </Text> |
There was a problem hiding this comment.
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.
| FulfillmentSetType.Pickup | ||
|
|
||
| const { stock_location, isError, error } = useStockLocation( | ||
| const { stock_location, isError, error, isLoading } = useStockLocation( |
There was a problem hiding this comment.
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.


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:
How to verify
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
useStockLocationfails (e.g., deleted/404 locations) by removing the explicitthrow errorpath and rendering a muted “Location deleted” placeholder instead of triggering the error boundary.Adds a patch changeset for
@medusajs/dashboarddocumenting the fix.Written by Cursor Bugbot for commit 4f6f3ff. This will update automatically on new commits. Configure here.