From 128daa3f8bac2625dbd0c12a9d43fad013eb9b37 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 23 May 2025 07:51:21 +0000 Subject: [PATCH] Fix: Ensure dummy getCollectionProducts safely handles empty generic product list Resolves a TypeScript type error in `lib/shopify/index.ts` within the dummy data logic for the `getCollectionProducts` function: "Type 'Product | undefined' is not assignable to type 'Product'." The error occurred when attempting to use `genericProducts[0]` without first ensuring that the `genericProducts` array (fetched from a dummy `getProducts({query: "generic"})` call) was not empty. The logic has been updated to check if `genericProducts.length > 0` before accessing `genericProducts[0]`. If the array is empty, `dummyCollectionProductsList` is set to an empty array, preventing the assignment of `undefined` to a variable typed as `Product[]`.