@@ -8,12 +8,12 @@ import { searchOverlayHelper } from '../utils/externalSearchUtils';
88
99export function CoordinatesDisplay ( {
1010 flipped,
11- mapRef ,
11+ mapObj ,
1212 externalSearchRef,
1313 externalSearchMarkerRef,
1414} : {
1515 flipped : boolean ;
16- mapRef : React . RefObject < Map | null > ;
16+ mapObj : Map ;
1717 externalSearchRef : React . RefObject < HTMLDivElement | null > ;
1818 externalSearchMarkerRef : React . RefObject < Feature < Geometry > | null > ;
1919} ) {
@@ -56,17 +56,15 @@ export function CoordinatesDisplay({
5656 } , [ ] ) ;
5757
5858 useEffect ( ( ) => {
59- if ( ! mapRef . current ) return ;
60- const currentMapRef = mapRef . current ;
59+ const currentMapRef = mapObj ;
6160 const updateCoords = ( e : MapBrowserEvent ) => setCoordinates ( e . coordinate ) ;
6261 currentMapRef . on ( 'pointermove' , updateCoords ) ;
6362 return ( ) => currentMapRef . un ( 'pointermove' , updateCoords ) ;
64- } , [ mapRef ] ) ;
63+ } , [ ] ) ;
6564
6665 const onSubmit = useCallback (
6766 ( e : FormEvent ) => {
6867 e . preventDefault ( ) ;
69- if ( ! mapRef . current ) return ;
7068 const formData = new FormData ( e . target as HTMLFormElement ) ;
7169 const raStr = String ( formData . get ( 'ra' ) ) ;
7270 const decStr = String ( formData . get ( 'dec' ) ) ;
@@ -79,9 +77,9 @@ export function CoordinatesDisplay({
7977 [ ra , dec ] ,
8078 flipped
8179 ) ;
82- mapRef . current . getView ( ) . setCenter ( transformedCoords ) ;
80+ mapObj . getView ( ) . setCenter ( transformedCoords ) ;
8381 searchOverlayHelper (
84- mapRef . current ,
82+ mapObj ,
8583 externalSearchRef ,
8684 externalSearchMarkerRef ,
8785 transformedCoords ,
@@ -93,7 +91,7 @@ export function CoordinatesDisplay({
9391 setShowCoordInputs ( false ) ;
9492 ( e . target as HTMLFormElement ) . reset ( ) ;
9593 } ,
96- [ mapRef , externalSearchRef , externalSearchMarkerRef , flipped ]
94+ [ mapObj , externalSearchRef , externalSearchMarkerRef , flipped ]
9795 ) ;
9896
9997 // Return early if coordinates aren't defined
0 commit comments