Closed nexttrack07 closed 2 weeks ago
Hi @nexttrack07 Please check PR #239, and let me know if it resolves this issue.
Thanks! Will check but doesn't look like the changes are release in a new version yet. Will it be released in 0.4.4?
@nexttrack07 Version 0.5.0 will be released soon Note that callbacks are still given as mapViewCallbacks prop. To detect changes, the mapViewCallbacks object need to be updated (as it is demonstrated in the SampleApp).
SDK Version: 0.4.3
The MapViewCallbacks are not getting recreated when a state value changes. If I define local state variable and I use that variable inside a callback then the callback always has the initial value of the variable even if the variable gets updated. This happens even when the mapViewCallback is defined using
useCallback
and the the variable is listed as a dependency.You can see that there is a console.log with appointmentMarkers inside
onMarkerClick
and there is one outside. The outside one has the correct value of the appointmentMarkers and is updated. The one inside theonMarkerClick
callback always has value[]
and never gets updated. This same code existed in version 0.3.4 and worked perfectly.I've tried putting
onMarkerClick
in auseCallback
, defined it outside then referenced, I've removed theuseMemo
frommapViewCallbacks
and it doesn't make any difference. The value of the state var inside any of mapViewCallbacks always stays the same and never updates.