When navigating from another page to the dashboard the map doesn't center on the content
noahflk opened this issue · 2 comments
noahflk commented
It only centers after manually reloading the page.
CleanShot.2022-12-11.at.23.39.23.mp4
mocherfaoui commented
I was able to fix this in two ways:
- by wrapping this
railtrack/src/components/Map.tsx
Lines 59 to 69 in b0062c9
inuseCallback
and use it withonLoad
- by using
reuseMaps
, the only problem with this solution is that Mapbox will remembers the last state of the map so if the user zoomed in/out or dragged the map it will remember that last position
noahflk commented
@mocherfaoui thank you! Just commited a fix using the onLoad