Skip to content

[Bug] Admin dashboard crashes when viewing customer with orders containing deleted product variants  #14371

@Sobefy

Description

@Sobefy

Package.json file

{
  "name": "vision-rescue-retail",
  "version": "0.0.1",
  "description": "A starter for Medusa projects.",
  "author": "Medusa (https://medusajs.com)",
  "license": "MIT",
  "keywords": [
    "sqlite",
    "postgres",
    "typescript",
    "ecommerce",
    "headless",
    "medusa"
  ],
  "scripts": {
    "build": "medusa build",
    "seed": "medusa exec ./src/scripts/seed.ts",
    "start": "medusa start",
    "dev": "NODE_OPTIONS='--max-old-space-size=8192' medusa develop",
    "test:integration:http": "TEST_TYPE=integration:http NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit",
    "test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit",
    "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit"
  },
  "dependencies": {
    "@aws-sdk/client-s3": "^3.948.0",
    "@eancarr/klaviyo-medusa": "^0.2.5",
    "@medusajs/admin-sdk": "2.12.3",
    "@medusajs/cli": "2.12.3",
    "@medusajs/file": "2.12.3",
    "@medusajs/file-local": "2.12.3",
    "@medusajs/framework": "2.12.3",
    "@medusajs/icons": "2.12.3",
    "@medusajs/medusa": "2.12.3",
    "@medusajs/ui": "4.0.31",
    "@react-email/components": "^1.0.1",
    "@react-email/render": "^2.0.0",
    "@types/multer": "^2.0.0",
    "algoliasearch": "^5.45.0",
    "https-proxy-agent": "^7.0.6",
    "multer": "^2.0.2",
    "node-fetch": "^2.7.0",
    "resend": "^6.4.2"
  },
  "devDependencies": {
    "@medusajs/test-utils": "2.12.3",
    "@swc/core": "^1.7.28",
    "@swc/jest": "^0.2.36",
    "@types/jest": "^29.5.13",
    "@types/node": "^20.0.0",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "jest": "^29.7.0",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "sharp": "^0.34.5",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "vite": "^5.2.11",
    "yalc": "^1.0.0-pre.53"
  },
  "engines": {
    "node": ">=20"
  },
  "optionalDependencies": {
    "@rollup/rollup-linux-arm64-gnu": "^4.52.3",
    "@swc/core-linux-arm64-gnu": "^1.7.28"
  }
}

Node.js version

2.12.3

Database and its version

PostgreSQL 16.11

Operating system name and version

MacOS 26.0.1 (25A362

Browser name

Chrome

What happended?

The admin dashboard crashes with a TypeError: Cannot read properties of undefined (reading 'reduce') when attempting to view a customer detail page where the customer has orders containing product variants that have been soft-deleted.

To Reproduce

  1. Create a customer and place an order with a product variant
  2. Delete the product variant (soft delete)
  3. Navigate to the customer detail page in admin (/admin/customers/{customer_id})
  4. The page crashes with the error

Expected behavior

The customer detail page should load successfully, displaying orders even if the associated product variants have been deleted. The order history should remain viewable since the order line items store the product/variant information at time of purchase.

Actual behavior

Actual behavior

The customer detail page crashes immediately upon loading. React Router catches the error and displays an error boundary. The browser console shows:

TypeError: Cannot read properties of undefined (reading 'reduce') at cell (chunk-EHU67PIM-BMUMX0qB.js:1:3101) at Jf (index-GickE7Mp.js:176:383) at sTe (index-GickE7Mp.js:192:9930) at XF (index-GickE7Mp.js:194:11975) at _D (index-GickE7Mp.js:211:2160) at IH (index-GickE7Mp.js:207:22381) at jSe (index-GickE7Mp.js:207:21958) at t0 (index-GickE7Mp.js:207:21708) at SD (index-GickE7Mp.js:207:18203) at EH (index-GickE7Mp.js:207:19594)

Link to reproduction repo

https://github.com/Sobefy-eCommerce-Agency/vision-rescue-retail

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions