fix(logistics): Hotels tab crash — Radix SelectItem cannot have empty value
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m58s

The 'Unassigned' rooming option used value="" which throws at runtime
(blank tab behind the error boundary). Use a sentinel value mapped to unassign.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt
2026-06-04 19:50:18 +02:00
parent 89ab5cc8e6
commit f2c8cc1e80

View File

@@ -38,6 +38,10 @@ import {
} from '@/components/ui/select' } from '@/components/ui/select'
import { Download, ExternalLink, Hotel as HotelIcon, Loader2, Plus, Trash2, Pencil } from 'lucide-react' import { Download, ExternalLink, Hotel as HotelIcon, Loader2, Plus, Trash2, Pencil } from 'lucide-react'
// Radix <SelectItem> forbids an empty-string value, so the "unassigned" option
// uses this sentinel; handleHotelChange maps it back to an unassign.
const UNASSIGN_VALUE = '__unassign__'
interface Props { interface Props {
programId: string programId: string
} }
@@ -439,7 +443,7 @@ function AttendeeRoomRow({
const currentHotelId = row.stay?.hotelId ?? '' const currentHotelId = row.stay?.hotelId ?? ''
const handleHotelChange = (value: string) => { const handleHotelChange = (value: string) => {
if (!value) { if (!value || value === UNASSIGN_VALUE) {
unassignMutation.mutate({ attendingMemberId: row.attendingMemberId }) unassignMutation.mutate({ attendingMemberId: row.attendingMemberId })
} else { } else {
assignMutation.mutate({ assignMutation.mutate({
@@ -506,7 +510,7 @@ function AttendeeRoomRow({
<SelectValue placeholder="— Unassigned —" /> <SelectValue placeholder="— Unassigned —" />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem value=""> Unassigned </SelectItem> <SelectItem value={UNASSIGN_VALUE}> Unassigned </SelectItem>
{hotels.map((h) => ( {hotels.map((h) => (
<SelectItem key={h.id} value={h.id}> <SelectItem key={h.id} value={h.id}>
{h.name} {h.name}