Skip to content

Commit

Permalink
fix(SKY30-507): Remove crash when collapsing sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
clementprdhomme committed Dec 2, 2024
1 parent ec0be43 commit 5c00131
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions frontend/src/components/map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,19 @@ export const Map: FC<CustomMapProps> = ({
const handleFitBounds = useCallback(() => {
if (mapRef && bounds) {
const { bbox, options } = bounds;
// enabling fly mode avoids the map to be interrupted during the bounds transition
setFlying(true);

mapRef.fitBounds(
[
[bbox[0], bbox[1]],
[bbox[2], bbox[3]],
],
options
);

if (bbox) {
// enabling fly mode avoids the map to be interrupted during the bounds transition
setFlying(true);

mapRef.fitBounds(
[
[bbox[0], bbox[1]],
[bbox[2], bbox[3]],
],
options
);
}
}
}, [bounds, mapRef]);

Expand Down

0 comments on commit 5c00131

Please sign in to comment.