File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
src/components/shared/map Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -168,13 +168,15 @@ const Map = ({
168
168
setError ( null ) ;
169
169
try {
170
170
// Fetch the current map bounds
171
- const bounds = mapRef . current ?. getBounds ( ) ;
171
+ // manually set bounds as mapref is null during component rendering phase
172
+ const bounds = L . latLngBounds (
173
+ L . latLng ( - 90 , - 180 ) ,
174
+ L . latLng ( 90 , 180 )
175
+ ) ;
172
176
173
- if ( bounds ) {
174
- let sellersData = await fetchSellerCoordinates ( bounds , '' ) ;
175
- sellersData = removeDuplicates ( sellersData ) ;
176
- setSellers ( sellersData ) ;
177
- }
177
+ let sellersData = await fetchSellerCoordinates ( bounds , '' ) ;
178
+ sellersData = removeDuplicates ( sellersData ) ;
179
+ setSellers ( sellersData ) ;
178
180
} catch ( error ) {
179
181
logger . error ( 'Failed to fetch initial coordinates:' , { error } ) ;
180
182
setError ( 'Failed to fetch initial coordinates' ) ;
You can’t perform that action at this time.
0 commit comments