feat: Recoil-Zustand 'poiLayerVisibleState' durch Redux ersetzt
- Recoil-Zugriffe in MapComponent.js, DataSheet.js, useMapComponentState.js entfernt - Redux Slice poiLayerVisibleSlice eingeführt - Redux Store konfiguriert - Zustand 'visible' wird über Redux verwaltet - CHANGELOG.md auf Version 1.1.82 aktualisiert
This commit is contained in:
@@ -1,9 +1,22 @@
|
||||
// /redux/slices/poiLayerVisibleSlice.js
|
||||
// Recoil atom for the visibility of the POI layer
|
||||
//
|
||||
import { atom } from "recoil";
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
export const poiLayerVisibleState = atom({
|
||||
key: "poiLayerVisibleState",
|
||||
default: true,
|
||||
const initialState = {
|
||||
visible: true,
|
||||
};
|
||||
|
||||
export const poiLayerVisibleSlice = createSlice({
|
||||
name: "poiLayerVisible",
|
||||
initialState,
|
||||
reducers: {
|
||||
setVisible: (state, action) => {
|
||||
state.visible = action.payload;
|
||||
},
|
||||
toggleVisible: (state) => {
|
||||
state.visible = !state.visible;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { setVisible, toggleVisible } = poiLayerVisibleSlice.actions;
|
||||
export default poiLayerVisibleSlice.reducer;
|
||||
|
||||
@@ -15,6 +15,7 @@ import polylineContextMenuReducer from "./slices/polylineContextMenuSlice";
|
||||
import selectedPoiReducer from "./slices/selectedPoiSlice";
|
||||
import selectedDeviceReducer from "./slices/selectedDeviceSlice";
|
||||
import mapLayersReducer from "./slices/mapLayersSlice";
|
||||
import poiLayerVisibleReducer from "./slices/poiLayerVisibleSlice";
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
@@ -33,5 +34,6 @@ export const store = configureStore({
|
||||
selectedPoi: selectedPoiReducer,
|
||||
selectedDevice: selectedDeviceReducer,
|
||||
mapLayers: mapLayersReducer,
|
||||
poiLayerVisible: poiLayerVisibleReducer,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user