Skip to content
Snippets Groups Projects

refactor(vector-map): modify redux to store element of multiple models

8 files
+ 54
46
Compare changes
  • Side-by-side
  • Inline
Files
8
@@ -24,7 +24,10 @@ import CompartmentCircle from '@/components/Map/MapViewer/MapViewerVector/utils/
import Glyph from '@/components/Map/MapViewer/MapViewerVector/utils/shapes/elements/Glyph';
import CompartmentPathway from '@/components/Map/MapViewer/MapViewerVector/utils/shapes/elements/CompartmentPathway';
import Reaction from '@/components/Map/MapViewer/MapViewerVector/utils/shapes/reaction/Reaction';
import { newReactionsForCurrentModelSelector } from '@/redux/newReactions/newReactions.selectors';
import {
newReactionsForCurrentModelSelector,
newReactionsLoadingSelector,
} from '@/redux/newReactions/newReactions.selectors';
import { getNewReactionsForModel } from '@/redux/newReactions/newReactions.thunks';
import { VECTOR_MAP_LAYER_TYPE } from '@/components/Map/MapViewer/MapViewerVector/MapViewerVector.constants';
import {
@@ -65,6 +68,7 @@ export const useOlMapReactionsLayer = ({
const bioEntities = useAppSelector(overlayBioEntitiesForCurrentModelSelector);
const reactionsForCurrentModel = useAppSelector(newReactionsForCurrentModelSelector);
const modelElementsLoading = useAppSelector(modelElementsLoadingSelector);
const reactionsLoading = useAppSelector(newReactionsLoadingSelector);
const modelElementsForCurrentModel = useAppSelector(modelElementsForCurrentModelSelector);
const debouncedBioEntities = useDebouncedValue(bioEntities, 1000);
@@ -87,10 +91,10 @@ export const useOlMapReactionsLayer = ({
if (modelElementsLoading !== 'succeeded') {
dispatch(getModelElementsForModel(currentModelId));
}
if (!reactionsForCurrentModel) {
if (reactionsLoading !== 'succeeded') {
dispatch(getNewReactionsForModel(currentModelId));
}
}, [currentModelId, dispatch, reactionsForCurrentModel, modelElementsLoading]);
}, [currentModelId, dispatch, reactionsLoading, modelElementsLoading]);
useEffect(() => {
if (overlaysOrder.length) {
Loading