mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 16:11:12 -05:00
Fix: React rendering error
This commit is contained in:
28
src/components/maps/DynamicParkLocationMap.tsx
Normal file
28
src/components/maps/DynamicParkLocationMap.tsx
Normal 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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user