Closed andrejilderda closed 3 months ago
Edit: not relevant anymore.
Hi @andrejilderda, thank you for raising the issue. We have been aware of this issue and it is fixed in the latest release 1.0.6 that was just released a few minutes ago.
Awesome, thanks a lot!
First, thanks for the work on this library!
I'm running into the issue that event handlers passed to
MlGeoJsonLayer
(and possibly other layers) are not properly updated. This occurs when for example an onClick-handler is passed to a<MlGeoJsonLayer>
which contains a stateful value.Version
@mapcomponents/react-maplibre 1.0.5 (latest)
Reproduction link:
https://codesandbox.io/p/sandbox/base-template-forked-ppjjjg?file=%2Fsrc%2FApp.js%3A275%2C13
Steps To Reproduce
The current behavior
When clicking on the route (red line), the
state.zoom
value logged in the console remains4
and does not reflect the updated zoom level.The expected behavior
When clicking on the route, the logged
state.zoom
value should reflect the updated zoom level (incremented by 1 from the previous value).Additional notes:
useLayer.ts
.If you need more information, feel free to reach out!
EDIT: Removed comment regarding useEffect firing twice (which is intended React behavior).