Skip to content

Commit

Permalink
Robustness improvements to useMapboxGLDraw startup
Browse files Browse the repository at this point in the history
  • Loading branch information
underbluewaters committed Oct 18, 2023
1 parent a9d2061 commit 016cef6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/client/src/draw/useMapboxGLDraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,16 @@ export default function useMapboxGLDraw(
number,
number
];
if (bounds && !Number.isNaN(bounds[0])) {
map.fitBounds(bounds, {
padding: isSmall ? 100 : 200,
animate: true,
duration: 500,
});
try {
if (bounds && !Number.isNaN(bounds[0])) {
map.fitBounds(bounds, {
padding: isSmall ? 100 : 200,
animate: true,
duration: 500,
});
}
} catch (e) {
// do nothing
}
}
}
Expand Down

0 comments on commit 016cef6

Please sign in to comment.