Fix: Display temp location data

This commit is contained in:
gpt-engineer-app[bot]
2025-11-06 04:37:48 +00:00
parent c8a015a15b
commit 93e8e98957
2 changed files with 9 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
if (!data) return;
const fetchRelatedData = async () => {
// Fetch location
// Fetch location if location_id exists (for edits)
if (data.location_id) {
const { data: locationData } = await supabase
.from('locations')
@@ -29,6 +29,10 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
.eq('id', data.location_id)
.single();
setLocation(locationData);
}
// Otherwise use temp_location_data (for new submissions)
else if (data.temp_location_data) {
setLocation(data.temp_location_data);
}
// Fetch operator
@@ -53,7 +57,7 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
};
fetchRelatedData();
}, [data.location_id, data.operator_id, data.property_owner_id]);
}, [data.location_id, data.temp_location_data, data.operator_id, data.property_owner_id]);
const getStatusColor = (status: string | undefined) => {
if (!status) return 'bg-gray-500';

View File

@@ -3,6 +3,8 @@
* These replace the `any` types in entityTransformers.ts
*/
import type { LocationData } from './location';
export interface ParkSubmissionData {
name: string;
slug: string;
@@ -19,6 +21,7 @@ export interface ParkSubmissionData {
operator_id?: string | null;
property_owner_id?: string | null;
location_id?: string | null;
temp_location_data?: LocationData | null;
banner_image_url?: string | null;
banner_image_id?: string | null;
card_image_url?: string | null;