@@ -130,10 +130,8 @@ export const MapView = forwardRef<any, MapViewProps>(
130130 try {
131131 // Use initialCenter/initialZoom if provided so the map starts at the
132132 // correct position without needing a programmatic camera move later.
133- const startCenter = ( initialCenter && isFinite ( initialCenter [ 0 ] ) && isFinite ( initialCenter [ 1 ] ) )
134- ? initialCenter
135- : [ - 98.5795 , 39.8283 ] as [ number , number ] ; // Default US center
136- const startZoom = ( initialZoom != null && isFinite ( initialZoom ) ) ? initialZoom : 4 ;
133+ const startCenter = initialCenter && isFinite ( initialCenter [ 0 ] ) && isFinite ( initialCenter [ 1 ] ) ? initialCenter : ( [ - 98.5795 , 39.8283 ] as [ number , number ] ) ; // Default US center
134+ const startZoom = initialZoom != null && isFinite ( initialZoom ) ? initialZoom : 4 ;
137135
138136 const newMap = new mapboxgl . Map ( {
139137 container : mapContainer . current ,
@@ -228,6 +226,7 @@ export const MapView = forwardRef<any, MapViewProps>(
228226 if ( typeof origRender === 'function' ) {
229227 newMap . _render = function ( ...args : unknown [ ] ) {
230228 try {
229+ // eslint-disable-next-line react/no-this-in-sfc
231230 const canvas = this . getCanvas ?.( ) ;
232231 if ( canvas && ( canvas . width === 0 || canvas . height === 0 ) ) {
233232 return this ; // skip frame when canvas is zero-sized
@@ -244,7 +243,7 @@ export const MapView = forwardRef<any, MapViewProps>(
244243 // that occur when mouse events fire while the map canvas is resizing.
245244 newMap . on ( 'error' , ( e : { error ?: Error } ) => {
246245 const msg = e . error ?. message ?? '' ;
247- if ( msg . includes ( 'Invalid LngLat' ) || msg . includes ( 'r[3]' ) ) {
246+ if ( msg . includes ( 'Invalid LngLat' ) ) {
248247 return ;
249248 }
250249 console . warn ( '[MapView.web] mapbox-gl error:' , e . error ) ;
@@ -349,10 +348,7 @@ export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLeve
349348 if ( ! map ) return ;
350349
351350 // Validate coordinates before passing to mapbox
352- if (
353- options . centerCoordinate &&
354- ( ! isFinite ( options . centerCoordinate [ 0 ] ) || ! isFinite ( options . centerCoordinate [ 1 ] ) )
355- ) {
351+ if ( options . centerCoordinate && ( ! isFinite ( options . centerCoordinate [ 0 ] ) || ! isFinite ( options . centerCoordinate [ 1 ] ) ) ) {
356352 return ;
357353 }
358354
@@ -371,11 +367,7 @@ export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLeve
371367 if ( ! map ) return ;
372368
373369 // Validate center if provided
374- if (
375- options . center &&
376- Array . isArray ( options . center ) &&
377- ( ! isFinite ( options . center [ 0 ] ) || ! isFinite ( options . center [ 1 ] ) )
378- ) {
370+ if ( options . center && Array . isArray ( options . center ) && ( ! isFinite ( options . center [ 0 ] ) || ! isFinite ( options . center [ 1 ] ) ) ) {
379371 return ;
380372 }
381373
@@ -386,12 +378,7 @@ export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLeve
386378 useEffect ( ( ) => {
387379 if ( ! map ) return ;
388380
389- if (
390- centerCoordinate &&
391- centerCoordinate . length === 2 &&
392- isFinite ( centerCoordinate [ 0 ] ) &&
393- isFinite ( centerCoordinate [ 1 ] )
394- ) {
381+ if ( centerCoordinate && centerCoordinate . length === 2 && isFinite ( centerCoordinate [ 0 ] ) && isFinite ( centerCoordinate [ 1 ] ) ) {
395382 // Skip the first render — the MapView already initialized at the correct
396383 // position via initialCenter/initialZoom, so no programmatic move needed.
397384 if ( ! hasInitialized . current ) {
@@ -418,7 +405,7 @@ export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLeve
418405 // Suppress projection-matrix errors during resize/transition
419406 }
420407 }
421- } , [ map , centerCoordinate ?. [ 0 ] , centerCoordinate ?. [ 1 ] , zoomLevel , heading , pitch , animationDuration , animationMode ] ) ;
408+ } , [ map , centerCoordinate , zoomLevel , heading , pitch , animationDuration , animationMode ] ) ;
422409
423410 useEffect ( ( ) => {
424411 if ( ! map || ! followUserLocation ) return ;
@@ -534,13 +521,7 @@ export const PointAnnotation: React.FC<PointAnnotationProps> = ({ id, coordinate
534521
535522 // Update coordinate when values actually change (by value, not reference)
536523 useEffect ( ( ) => {
537- if (
538- markerRef . current &&
539- coordinate &&
540- coordinate . length === 2 &&
541- isFinite ( coordinate [ 0 ] ) &&
542- isFinite ( coordinate [ 1 ] )
543- ) {
524+ if ( markerRef . current && coordinate && coordinate . length === 2 && isFinite ( coordinate [ 0 ] ) && isFinite ( coordinate [ 1 ] ) ) {
544525 markerRef . current . setLngLat ( coordinate ) ;
545526 }
546527 // eslint-disable-next-line react-hooks/exhaustive-deps
0 commit comments