Skip to content

Commit

Permalink
Refactor getting cluster ids
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristian-A committed Jul 13, 2022
1 parent e0ac266 commit e34d7b4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/redux/actions/componentConfig/fetchPlotDataWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import generatePlotWorkBody from 'utils/work/generatePlotWorkBody';
import { fetchWork } from 'utils/work/fetchWork';

const getClusterNames = (state) => {
const clusterIds = state.cellSets.hierarchy[0]?.children.map((entry) => entry.key);
const customClusterIds = state.cellSets.hierarchy[1]?.children.map((entry) => entry.key);
const clusterIds = state.cellSets.hierarchy.reduce(
(acc, cellSet) => [...acc, ...cellSet.children.map((entry) => entry.key)],
[],
);

const allClusterIds = clusterIds?.concat(customClusterIds);
const clusterNames = allClusterIds?.map((clusterId) => state.cellSets.properties[clusterId].name);
const clusterNames = clusterIds?.map((clusterId) => state.cellSets.properties[clusterId].name);
return clusterNames;
};

Expand All @@ -24,7 +25,7 @@ const fetchPlotDataWork = (
let config = getState().componentConfig[plotUuid]?.config ?? initialPlotConfigStates[plotType];
const clusterNames = getClusterNames(getState());
const timeout = getTimeoutForWorkerTask(getState(), 'PlotData');

console.error(clusterNames);
config = {
...config,
clusterNames,
Expand Down

0 comments on commit e34d7b4

Please sign in to comment.