PackagesStep: look up selected package in both primary + same-provider-more lists

Clicking a package in the "Other packages from [Provider]" section set
the selectedPackageId correctly but the detail panel stayed on the empty
state — `selectedPackage` was derived only from the primary `packages`
array, so secondary-list ids never resolved. Now falls back to the
secondary list when the primary miss.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 13:56:08 +10:00
parent 9b6d541a6a
commit dcfbfc97ce

View File

@@ -214,7 +214,14 @@ export const PackagesStep: React.FC<PackagesStepProps> = ({
sx, sx,
}) => { }) => {
const copy = TIER_COPY[providerTier]; const copy = TIER_COPY[providerTier];
const selectedPackage = packages.find((p) => p.id === selectedPackageId); // Look up the selected package across BOTH the primary list and the
// same-provider-more secondary list — tapping "Premium Funeral Service"
// in the "Other packages from X" section should surface its detail too.
const selectedPackage =
packages.find((p) => p.id === selectedPackageId) ??
(secondaryList?.kind === 'same-provider-more'
? secondaryList.packages.find((p) => p.id === selectedPackageId)
: undefined);
// Mobile drill-in: on mobile, the list is the default view — only when the // Mobile drill-in: on mobile, the list is the default view — only when the
// user explicitly taps a package do we swap in the detail panel. This // user explicitly taps a package do we swap in the detail panel. This