[ad_1]
I’m experimenting a problem with Zustand, I’m updating a state that is based on another state that is in a nested object, this state is not being updated properly… here an example:
mapUpdate: (update: Partial<MapState['map']>) => {
set((state) => {
return {
...state,
map: {
...state.map,
...update,
canShowCarouselResults:
state.map.zoom >= MIN_MAP_RESULTS_CAROUSEL_ZOOM,
},
canShowMarketResults: state.map.zoom <= MIN_RESULTS_ZOOM,
};
});
}
I need to update canShowMArketResults
according to zoom state, zoom state is in map state object… the zoom state is updating correctly but the canShowMarketResoults
status is not taking some map.zoom changes.
[ad_2]