Fix: React rendering error

This commit is contained in:
gpt-engineer-app[bot]
2025-09-29 13:37:04 +00:00
parent 90ba2c21ce
commit c3ab49f7c1
2 changed files with 30 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
import React, { Suspense, lazy } from 'react';
import { Skeleton } from '@/components/ui/skeleton';
interface ParkLocationMapProps {
latitude: number;
longitude: number;
parkName: string;
className?: string;
}
// Lazy load the map component to avoid React 18 issues with react-leaflet
const ParkLocationMapComponent = lazy(() =>
import('./ParkLocationMap').then(mod => ({ default: mod.ParkLocationMap }))
);
const MapSkeleton = () => (
<div className="w-full h-64 rounded-lg border border-border">
<Skeleton className="w-full h-full rounded-lg" />
</div>
);
export function DynamicParkLocationMap(props: ParkLocationMapProps) {
return (
<Suspense fallback={<MapSkeleton />}>
<ParkLocationMapComponent {...props} />
</Suspense>
);
}