Skip to content
Snippets Groups Projects
Commit c05a3e85 authored by Miłosz Grocholewski's avatar Miłosz Grocholewski
Browse files

fix(vector-map): avoid clearing submap connections on clear bioentities data

parent 691908f3
No related branches found
No related tags found
1 merge request!316fix(vector-map): avoid clearing submap connections on clear bioentities data
......@@ -2,7 +2,7 @@
import { updateLastClick } from '@/redux/map/map.slice';
import { closeDrawer } from '@/redux/drawer/drawer.slice';
import { resetReactionsData } from '@/redux/reactions/reactions.slice';
import { clearBioEntitiesData } from '@/redux/bioEntity/bioEntity.slice';
import { clearBioEntities } from '@/redux/bioEntity/bioEntity.slice';
import { handleFeaturesClick } from '@/components/Map/MapViewer/utils/listeners/mapSingleClick/handleFeaturesClick';
import Map from 'ol/Map';
import { onMapLeftClick } from '@/components/Map/MapViewer/MapViewerVector/listeners/mouseClick/mouseLeftClick/onMapLeftClick';
......@@ -66,7 +66,7 @@ describe('onMapLeftClick', () => {
expect(dispatch).toHaveBeenCalledWith(updateLastClick(expect.any(Object)));
expect(dispatch).toHaveBeenCalledWith(closeDrawer());
expect(dispatch).toHaveBeenCalledWith(resetReactionsData());
expect(dispatch).toHaveBeenCalledWith(clearBioEntitiesData());
expect(dispatch).toHaveBeenCalledWith(clearBioEntities());
});
it('calls leftClickHandleAlias if feature type is ALIAS', async () => {
......
......@@ -7,7 +7,7 @@ import { toLonLat } from 'ol/proj';
import { latLngToPoint } from '@/utils/map/latLngToPoint';
import { FeatureLike } from 'ol/Feature';
import { closeDrawer } from '@/redux/drawer/drawer.slice';
import { clearBioEntitiesData } from '@/redux/bioEntity/bioEntity.slice';
import { clearBioEntities } from '@/redux/bioEntity/bioEntity.slice';
import { leftClickHandleAlias } from '@/components/Map/MapViewer/MapViewerVector/listeners/mouseClick/mouseLeftClick/leftClickHandleAlias';
import { handleFeaturesClick } from '@/components/Map/MapViewer/utils/listeners/mapSingleClick/handleFeaturesClick';
import { resetReactionsData } from '@/redux/reactions/reactions.slice';
......@@ -39,7 +39,7 @@ export const onMapLeftClick =
}
dispatch(resetReactionsData());
dispatch(clearBioEntitiesData());
dispatch(clearBioEntities());
return;
}
......
......@@ -115,6 +115,11 @@ export const clearBioEntitiesDataReducer = (state: BioEntityContentsState): void
state.submapConnections = BIOENTITY_SUBMAP_CONNECTIONS_INITIAL_STATE;
};
export const clearBioEntitiesReducer = (state: BioEntityContentsState): void => {
state.data = [];
state.loading = 'idle';
};
export const toggleIsContentTabOpenedReducer = (
state: BioEntityContentsState,
action: PayloadAction<boolean>,
......
......@@ -2,6 +2,7 @@ import { createSlice } from '@reduxjs/toolkit';
import { BIOENTITY_INITIAL_STATE } from './bioEntity.constants';
import {
clearBioEntitiesDataReducer,
clearBioEntitiesReducer,
getBioEntityContentsReducer,
getMultiBioEntityContentsReducer,
getSubmapConnectionsBioEntityReducer,
......@@ -15,6 +16,7 @@ export const bioEntityContentsSlice = createSlice({
initialState: BIOENTITY_INITIAL_STATE,
reducers: {
clearBioEntitiesData: clearBioEntitiesDataReducer,
clearBioEntities: clearBioEntitiesReducer,
toggleIsContentTabOpened: toggleIsContentTabOpenedReducer,
setBioEntityContents: setBioEntityContentsReducer,
setMultipleBioEntityContents: setMultipleBioEntityContentsReducer,
......@@ -28,6 +30,7 @@ export const bioEntityContentsSlice = createSlice({
export const {
clearBioEntitiesData,
clearBioEntities,
toggleIsContentTabOpened,
setBioEntityContents,
setMultipleBioEntityContents,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment