Skip to content

Commit 5cbcd9f

Browse files
committed
fix typescript error
Signed-off-by: Ayoub LABIDI <[email protected]>
1 parent e5d5ba4 commit 5cbcd9f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/components/network/network-map-panel.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
*/
77

8-
import type { Writable } from 'type-fest';
98
import {
109
type Coordinate,
1110
DRAW_EVENT,
@@ -1030,14 +1029,17 @@ export const NetworkMapPanel = forwardRef<NetworkMapPanelRef, NetworkMapPanelPro
10301029
setShouldOpenSelectionCreationPanel(false);
10311030
}, [isInDrawingMode]);
10321031

1033-
const getCurrentMapState = useCallback(() => {
1032+
const getCurrentMapState = useCallback((): MapState => {
10341033
const currentMapState = networkMapRef.current?.getCurrentViewState();
1034+
1035+
const center: [number, number] = [
1036+
currentMapState?.center.lng ?? INITIAL_POSITION[0],
1037+
currentMapState?.center.lat ?? INITIAL_POSITION[1],
1038+
];
1039+
10351040
return {
10361041
zoom: currentMapState?.zoom ?? INITIAL_ZOOM,
1037-
center: [
1038-
currentMapState?.center.lng ?? INITIAL_POSITION[0],
1039-
currentMapState?.center.lat ?? INITIAL_POSITION[1],
1040-
],
1042+
center,
10411043
filteredNominalVoltages: filteredNominalVoltages,
10421044
};
10431045
}, [filteredNominalVoltages]);

0 commit comments

Comments
 (0)