diff --git a/packages/app/components/trip/TripCards/TripActivityCard.tsx b/packages/app/components/trip/TripCards/TripActivityCard.tsx index d92f2a9f4..2f5e83a25 100644 --- a/packages/app/components/trip/TripCards/TripActivityCard.tsx +++ b/packages/app/components/trip/TripCards/TripActivityCard.tsx @@ -10,10 +10,12 @@ import { Select as OriginalSelect } from '@packrat/ui'; const Select: any = OriginalSelect; -const ActivityOptions = Object.values(TripActivity).map((activity) => ({ - label: formatTripActivityLabel(activity), - value: activity, -})); +const ActivityOptions = TripActivity + ? Object.values(TripActivity).map((activity) => ({ + label: formatTripActivityLabel(activity), + value: activity, + })) + : []; interface TripActivityCardProps { onChange: (activity: string) => void; diff --git a/packages/app/modules/item/hooks/useItem.ts b/packages/app/modules/item/hooks/useItem.ts index bab2eff5a..8260d94c7 100644 --- a/packages/app/modules/item/hooks/useItem.ts +++ b/packages/app/modules/item/hooks/useItem.ts @@ -1,10 +1,29 @@ import { useAuthUser } from 'app/modules/auth'; import { queryTrpc } from 'app/trpc'; +type Item = { + id: string; + name: string; + weight: number; + unit: string; + categoryId: string; + ownerId: string; + global: boolean; + sku: string; + productUrl: string; + description: string; + productDetails: Record; + seller: string; + createdAt: string; + updatedAt: string; + images: { url: string }[]; + category: { id: string; name: string }; +}; + export const useItem = (itemId?: string) => { const user = useAuthUser(); const { refetch, data, error, isLoading, isError } = - queryTrpc.getItemById.useQuery( + queryTrpc.getItemById.useQuery( { id: itemId ?? '' }, { enabled: !!itemId, // to ensure the query runs only when packId is available @@ -16,5 +35,7 @@ export const useItem = (itemId?: string) => { ); const isOwner = data && user && data.ownerId === user.id; + console.log('useItem', { data }); + return { refetch, data, error, isLoading, isOwner, isError }; }; diff --git a/packages/app/modules/item/screens/ItemDetailsScreen.tsx b/packages/app/modules/item/screens/ItemDetailsScreen.tsx index 5274b9d29..b1b680492 100644 --- a/packages/app/modules/item/screens/ItemDetailsScreen.tsx +++ b/packages/app/modules/item/screens/ItemDetailsScreen.tsx @@ -42,7 +42,7 @@ export function ItemDetailsScreen() { {Platform.OS === 'web' ? ( - {item?.categoryId} + {item?.category?.name} ) : ( router.push('/products')}>