From 0f930c29e1e3eb4943a0e4be7d234d21bf25bb6a Mon Sep 17 00:00:00 2001 From: Kristian-A Date: Thu, 7 Jul 2022 17:05:08 +0100 Subject: [PATCH 01/10] Make dotplot rerender upon cluster rename --- .../plots-and-tables/dot-plot/index.jsx | 10 ++++++-- .../componentConfig/fetchPlotDataWork.js | 9 +++++-- src/utils/work/fetchWork.js | 24 ++++++++++++++----- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx b/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx index 453a6a7113..1c7ceaebd5 100644 --- a/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx +++ b/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx @@ -95,6 +95,9 @@ const DotPlotPage = (props) => { } = useSelector((state) => state.genes.properties.views[plotUuid] || {}); const cellSets = useSelector(getCellSets()); + + + const { loading: cellSetsLoading, error: cellSetsError, @@ -102,6 +105,9 @@ const DotPlotPage = (props) => { properties: cellSetProperties, } = cellSets; + + const clusterNames = Object.values(cellSetProperties).map((el) => el.name); + const [moreThanTwoGroups, setMoreThanTwoGroups] = useState(false); const experimentName = useSelector((state) => state.experimentSettings.info.experimentName); const csvFileName = fileNames(experimentName, 'DOT_PLOT', [config?.selectedCellSet, config?.selectedPoints]); @@ -183,7 +189,7 @@ const DotPlotPage = (props) => { const currentComparedConfig = getComparedConfig(config); if (config && !_.isEqual(previousComparedConfig.current, currentComparedConfig)) { previousComparedConfig.current = currentComparedConfig; - dispatch(fetchPlotDataWork(experimentId, plotUuid, plotType)); + dispatch(fetchPlotDataWork(experimentId, plotUuid, plotType, clusterNames)); } }, [config, cellSetProperties]); @@ -292,7 +298,7 @@ const DotPlotPage = (props) => { dispatch(fetchPlotDataWork(experimentId, plotUuid, plotType))} + onClick={() => dispatch(fetchPlotDataWork(experimentId, plotUuid, plotType, clusterNames))} /> ); diff --git a/src/redux/actions/componentConfig/fetchPlotDataWork.js b/src/redux/actions/componentConfig/fetchPlotDataWork.js index b93a655561..81f39c8737 100644 --- a/src/redux/actions/componentConfig/fetchPlotDataWork.js +++ b/src/redux/actions/componentConfig/fetchPlotDataWork.js @@ -7,7 +7,12 @@ import endUserMessages from 'utils/endUserMessages'; import generatePlotWorkBody from 'utils/work/generatePlotWorkBody'; import { fetchWork } from 'utils/work/fetchWork'; -const fetchPlotDataWork = (experimentId, plotUuid, plotType) => async (dispatch, getState) => { +const fetchPlotDataWork = ( + experimentId, + plotUuid, + plotType, + clusterNames, +) => async (dispatch, getState) => { const config = getState().componentConfig[plotUuid]?.config ?? initialPlotConfigStates[plotType]; const timeout = getTimeoutForWorkerTask(getState(), 'PlotData'); @@ -20,7 +25,7 @@ const fetchPlotDataWork = (experimentId, plotUuid, plotType) => async (dispatch, }); const data = await fetchWork( - experimentId, body, getState, { timeout }, + experimentId, body, getState, { timeout, clusterNames }, ); dispatch({ diff --git a/src/utils/work/fetchWork.js b/src/utils/work/fetchWork.js index fe8d8bf9db..f93801a76b 100644 --- a/src/utils/work/fetchWork.js +++ b/src/utils/work/fetchWork.js @@ -106,7 +106,13 @@ const fetchWork = async ( getState, optionals = {}, ) => { - const { extras = undefined, timeout = 180, broadcast = false } = optionals; + const { + extras = undefined, + timeout = 180, + broadcast = false, + clusterNames = [], + } = optionals; + const backendStatus = getBackendStatus(experimentId)(getState()).status; const { environment } = getState().networkResources; @@ -129,13 +135,19 @@ const fetchWork = async ( // If caching is disabled, we add an additional randomized key to the hash so we never reuse // past results. - let cacheUniquenessKey = null; - if (environment !== Environment.PRODUCTION && localStorage.getItem('disableCache') === 'true') { - cacheUniquenessKey = Math.random(); - } + // let cacheUniquenessKey = null; + // if (environment !== Environment.PRODUCTION + // && localStorage.getItem('disableCache') === 'true') { + // cacheUniquenessKey = Math.random(); + // } const ETag = createObjectHash({ - experimentId, body, qcPipelineStartDate, extras, cacheUniquenessKey, + experimentId, + body, + qcPipelineStartDate, + extras, + // cacheUniquenessKey, + clusterNames, }); // First, let's try to fetch this information from the local cache. From 5b760c5c180f972ca4b0416f7bb54b52a4c968c7 Mon Sep 17 00:00:00 2001 From: Kristian-A Date: Mon, 11 Jul 2022 11:05:35 +0100 Subject: [PATCH 02/10] Revert enable/disable cache options --- src/utils/work/fetchWork.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/utils/work/fetchWork.js b/src/utils/work/fetchWork.js index f93801a76b..b5a312b1b0 100644 --- a/src/utils/work/fetchWork.js +++ b/src/utils/work/fetchWork.js @@ -135,18 +135,17 @@ const fetchWork = async ( // If caching is disabled, we add an additional randomized key to the hash so we never reuse // past results. - // let cacheUniquenessKey = null; - // if (environment !== Environment.PRODUCTION - // && localStorage.getItem('disableCache') === 'true') { - // cacheUniquenessKey = Math.random(); - // } + let cacheUniquenessKey = null; + if (environment !== Environment.PRODUCTION && localStorage.getItem('disableCache') === 'true') { + cacheUniquenessKey = Math.random(); + } const ETag = createObjectHash({ experimentId, body, qcPipelineStartDate, extras, - // cacheUniquenessKey, + cacheUniquenessKey, clusterNames, }); From 7547bb79ff971c66c4b1dcd2d9521cfe617fc328 Mon Sep 17 00:00:00 2001 From: Kristian-A Date: Mon, 11 Jul 2022 13:09:37 +0100 Subject: [PATCH 03/10] WIP - fix tests --- .../__snapshots__/ExpressionCellSetModal.test.jsx.snap | 2 +- .../__snapshots__/loadPaginatedGeneProperties.test.js.snap | 2 +- src/__test__/utils/work/fetchWork.test.js | 2 +- src/utils/work/fetchWork.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/__test__/components/data-exploration/generic-gene-table/__snapshots__/ExpressionCellSetModal.test.jsx.snap b/src/__test__/components/data-exploration/generic-gene-table/__snapshots__/ExpressionCellSetModal.test.jsx.snap index 07d5f4eaee..1d4b66c7f2 100644 --- a/src/__test__/components/data-exploration/generic-gene-table/__snapshots__/ExpressionCellSetModal.test.jsx.snap +++ b/src/__test__/components/data-exploration/generic-gene-table/__snapshots__/ExpressionCellSetModal.test.jsx.snap @@ -19,7 +19,7 @@ Array [ "name": "GetExpressionCellSets", }, 180, - "bff42d1a0fd631bdb2a72de335468764", + "59933d6066e7194a95003acb680a2c9b", Object { "PipelineRunETag": "2021-10-20T12:51:44.755Z", "broadcast": true, diff --git a/src/__test__/redux/actions/genes/__snapshots__/loadPaginatedGeneProperties.test.js.snap b/src/__test__/redux/actions/genes/__snapshots__/loadPaginatedGeneProperties.test.js.snap index 0138ce7ae2..490ff49585 100644 --- a/src/__test__/redux/actions/genes/__snapshots__/loadPaginatedGeneProperties.test.js.snap +++ b/src/__test__/redux/actions/genes/__snapshots__/loadPaginatedGeneProperties.test.js.snap @@ -85,7 +85,7 @@ Array [ ], }, 60, - "97ad02a589a9066c83a355836f1c667e", + "9f493b777975162a6fa0a8d480cb0c09", Object { "PipelineRunETag": "2021-01-01T01:01:01.000Z", "broadcast": false, diff --git a/src/__test__/utils/work/fetchWork.test.js b/src/__test__/utils/work/fetchWork.test.js index 1b4cab5745..294a089ecb 100644 --- a/src/__test__/utils/work/fetchWork.test.js +++ b/src/__test__/utils/work/fetchWork.test.js @@ -18,7 +18,7 @@ jest.mock('utils/cache', () => require('__test__/utils/work/fetchWork.mock').moc jest.mock('utils/work/seekWorkResponse', () => require('__test__/utils/work/fetchWork.mock').mockSeekWorkResponseModule); const experimentId = '1234'; -const NON_GENE_EXPRESSION_ETAG = '013c3026bb7156d222ccd18919745195'; // pragma: allowlist secret +const NON_GENE_EXPRESSION_ETAG = '3ebcb92e53c10a67614c6dcc12f8c8d4'; // pragma: allowlist secret const GENE_EXPRESSION_ETAG = '34c05c9d07fd24ce0c22d2bec7fd7437'; // pragma: allowlist secret const timeout = 10; diff --git a/src/utils/work/fetchWork.js b/src/utils/work/fetchWork.js index b5a312b1b0..ccf9aaeb35 100644 --- a/src/utils/work/fetchWork.js +++ b/src/utils/work/fetchWork.js @@ -110,7 +110,7 @@ const fetchWork = async ( extras = undefined, timeout = 180, broadcast = false, - clusterNames = [], + clusterNames = undefined, } = optionals; const backendStatus = getBackendStatus(experimentId)(getState()).status; From fe590ad87ca013c8e4862598031b5e7cb169f783 Mon Sep 17 00:00:00 2001 From: Kristian-A Date: Mon, 11 Jul 2022 18:03:49 +0100 Subject: [PATCH 04/10] Move cluster names in plot body. Remove old implementation --- .../plots-and-tables/dot-plot/index.jsx | 4 ++-- .../actions/componentConfig/fetchPlotDataWork.js | 13 ++++++++++--- src/utils/work/generatePlotWorkBody.js | 7 ++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx b/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx index 1c7ceaebd5..de3c55ed13 100644 --- a/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx +++ b/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx @@ -189,7 +189,7 @@ const DotPlotPage = (props) => { const currentComparedConfig = getComparedConfig(config); if (config && !_.isEqual(previousComparedConfig.current, currentComparedConfig)) { previousComparedConfig.current = currentComparedConfig; - dispatch(fetchPlotDataWork(experimentId, plotUuid, plotType, clusterNames)); + dispatch(fetchPlotDataWork(experimentId, plotUuid, plotType)); } }, [config, cellSetProperties]); @@ -298,7 +298,7 @@ const DotPlotPage = (props) => { dispatch(fetchPlotDataWork(experimentId, plotUuid, plotType, clusterNames))} + onClick={() => dispatch(fetchPlotDataWork(experimentId, plotUuid, plotType))} /> ); diff --git a/src/redux/actions/componentConfig/fetchPlotDataWork.js b/src/redux/actions/componentConfig/fetchPlotDataWork.js index 81f39c8737..c0cbdc5d2e 100644 --- a/src/redux/actions/componentConfig/fetchPlotDataWork.js +++ b/src/redux/actions/componentConfig/fetchPlotDataWork.js @@ -7,17 +7,24 @@ import endUserMessages from 'utils/endUserMessages'; 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 clusterNames = clusterIds?.map((clusterId) => state.cellSets.properties[clusterId].name); + + return clusterNames; +}; + const fetchPlotDataWork = ( experimentId, plotUuid, plotType, - clusterNames, ) => async (dispatch, getState) => { const config = getState().componentConfig[plotUuid]?.config ?? initialPlotConfigStates[plotType]; + const clusterNames = getClusterNames(getState()); const timeout = getTimeoutForWorkerTask(getState(), 'PlotData'); try { - const body = generatePlotWorkBody(plotType, config); + const body = generatePlotWorkBody(plotType, config, clusterNames); dispatch({ type: PLOT_DATA_LOADING, @@ -25,7 +32,7 @@ const fetchPlotDataWork = ( }); const data = await fetchWork( - experimentId, body, getState, { timeout, clusterNames }, + experimentId, body, getState, { timeout }, ); dispatch({ diff --git a/src/utils/work/generatePlotWorkBody.js b/src/utils/work/generatePlotWorkBody.js index 62d4bc34a7..d5fa2357e3 100644 --- a/src/utils/work/generatePlotWorkBody.js +++ b/src/utils/work/generatePlotWorkBody.js @@ -1,6 +1,6 @@ import { plotTypes } from 'utils/constants'; -const composeDotPlotWorkBody = (config) => { +const composeDotPlotWorkBody = (config, clusterNames) => { const [filterGroup, filterKey] = config.selectedPoints.split('/'); return { @@ -9,6 +9,7 @@ const composeDotPlotWorkBody = (config) => { numberOfMarkers: config.nMarkerGenes, customGenesList: config.selectedGenes, groupBy: config.selectedCellSet, + clusterNames, filterBy: { group: filterGroup, key: filterKey || 'All', @@ -16,10 +17,10 @@ const composeDotPlotWorkBody = (config) => { }; }; -const generatePlotWorkBody = (plotType, config) => { +const generatePlotWorkBody = (plotType, config, clusterNames) => { switch (plotType) { case plotTypes.DOT_PLOT: - return composeDotPlotWorkBody(config); + return composeDotPlotWorkBody(config, clusterNames); default: { throw new Error('Plot type doesn\'t exist'); } From bbd92c3206b7cde548d5fbf451da030cd7a04c47 Mon Sep 17 00:00:00 2001 From: Kristian-A Date: Tue, 12 Jul 2022 13:08:20 +0100 Subject: [PATCH 05/10] Fix tests --- .../utils/work/__snapshots__/generatePlotWorkBody.test.js.snap | 1 + 1 file changed, 1 insertion(+) diff --git a/src/__test__/utils/work/__snapshots__/generatePlotWorkBody.test.js.snap b/src/__test__/utils/work/__snapshots__/generatePlotWorkBody.test.js.snap index dffb17e096..cb0b8f420a 100644 --- a/src/__test__/utils/work/__snapshots__/generatePlotWorkBody.test.js.snap +++ b/src/__test__/utils/work/__snapshots__/generatePlotWorkBody.test.js.snap @@ -2,6 +2,7 @@ exports[`Generate plot work request body Generates the correct work request body for DotPlot 1`] = ` Object { + "clusterNames": undefined, "customGenesList": Array [], "filterBy": Object { "group": "All", From 27aa734a1a81fd06b5291f46ce8d16ef35001ddf Mon Sep 17 00:00:00 2001 From: Kristian-A Date: Tue, 12 Jul 2022 15:22:15 +0100 Subject: [PATCH 06/10] Remove unused code --- .../[experimentId]/plots-and-tables/dot-plot/index.jsx | 5 ----- src/utils/work/fetchWork.js | 2 -- 2 files changed, 7 deletions(-) diff --git a/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx b/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx index de3c55ed13..4c63eb269a 100644 --- a/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx +++ b/src/pages/experiments/[experimentId]/plots-and-tables/dot-plot/index.jsx @@ -96,8 +96,6 @@ const DotPlotPage = (props) => { const cellSets = useSelector(getCellSets()); - - const { loading: cellSetsLoading, error: cellSetsError, @@ -105,9 +103,6 @@ const DotPlotPage = (props) => { properties: cellSetProperties, } = cellSets; - - const clusterNames = Object.values(cellSetProperties).map((el) => el.name); - const [moreThanTwoGroups, setMoreThanTwoGroups] = useState(false); const experimentName = useSelector((state) => state.experimentSettings.info.experimentName); const csvFileName = fileNames(experimentName, 'DOT_PLOT', [config?.selectedCellSet, config?.selectedPoints]); diff --git a/src/utils/work/fetchWork.js b/src/utils/work/fetchWork.js index ccf9aaeb35..e123628ecd 100644 --- a/src/utils/work/fetchWork.js +++ b/src/utils/work/fetchWork.js @@ -110,7 +110,6 @@ const fetchWork = async ( extras = undefined, timeout = 180, broadcast = false, - clusterNames = undefined, } = optionals; const backendStatus = getBackendStatus(experimentId)(getState()).status; @@ -146,7 +145,6 @@ const fetchWork = async ( qcPipelineStartDate, extras, cacheUniquenessKey, - clusterNames, }); // First, let's try to fetch this information from the local cache. From c8271d2b2e93e0b5e9e2ce5fd1377d22813345db Mon Sep 17 00:00:00 2001 From: Kristian-A Date: Tue, 12 Jul 2022 15:49:13 +0100 Subject: [PATCH 07/10] Fix tests --- .../__snapshots__/ExpressionCellSetModal.test.jsx.snap | 2 +- .../__snapshots__/loadPaginatedGeneProperties.test.js.snap | 2 +- src/__test__/utils/work/fetchWork.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/__test__/components/data-exploration/generic-gene-table/__snapshots__/ExpressionCellSetModal.test.jsx.snap b/src/__test__/components/data-exploration/generic-gene-table/__snapshots__/ExpressionCellSetModal.test.jsx.snap index 1d4b66c7f2..07d5f4eaee 100644 --- a/src/__test__/components/data-exploration/generic-gene-table/__snapshots__/ExpressionCellSetModal.test.jsx.snap +++ b/src/__test__/components/data-exploration/generic-gene-table/__snapshots__/ExpressionCellSetModal.test.jsx.snap @@ -19,7 +19,7 @@ Array [ "name": "GetExpressionCellSets", }, 180, - "59933d6066e7194a95003acb680a2c9b", + "bff42d1a0fd631bdb2a72de335468764", Object { "PipelineRunETag": "2021-10-20T12:51:44.755Z", "broadcast": true, diff --git a/src/__test__/redux/actions/genes/__snapshots__/loadPaginatedGeneProperties.test.js.snap b/src/__test__/redux/actions/genes/__snapshots__/loadPaginatedGeneProperties.test.js.snap index 490ff49585..0138ce7ae2 100644 --- a/src/__test__/redux/actions/genes/__snapshots__/loadPaginatedGeneProperties.test.js.snap +++ b/src/__test__/redux/actions/genes/__snapshots__/loadPaginatedGeneProperties.test.js.snap @@ -85,7 +85,7 @@ Array [ ], }, 60, - "9f493b777975162a6fa0a8d480cb0c09", + "97ad02a589a9066c83a355836f1c667e", Object { "PipelineRunETag": "2021-01-01T01:01:01.000Z", "broadcast": false, diff --git a/src/__test__/utils/work/fetchWork.test.js b/src/__test__/utils/work/fetchWork.test.js index 294a089ecb..1b4cab5745 100644 --- a/src/__test__/utils/work/fetchWork.test.js +++ b/src/__test__/utils/work/fetchWork.test.js @@ -18,7 +18,7 @@ jest.mock('utils/cache', () => require('__test__/utils/work/fetchWork.mock').moc jest.mock('utils/work/seekWorkResponse', () => require('__test__/utils/work/fetchWork.mock').mockSeekWorkResponseModule); const experimentId = '1234'; -const NON_GENE_EXPRESSION_ETAG = '3ebcb92e53c10a67614c6dcc12f8c8d4'; // pragma: allowlist secret +const NON_GENE_EXPRESSION_ETAG = '013c3026bb7156d222ccd18919745195'; // pragma: allowlist secret const GENE_EXPRESSION_ETAG = '34c05c9d07fd24ce0c22d2bec7fd7437'; // pragma: allowlist secret const timeout = 10; From e0ac266f56971f2f77708cc8a7ccac0181123e38 Mon Sep 17 00:00:00 2001 From: Kristian-A Date: Wed, 13 Jul 2022 13:03:56 +0100 Subject: [PATCH 08/10] Move cluster names into config --- .../actions/componentConfig/fetchPlotDataWork.js | 13 ++++++++++--- src/utils/work/generatePlotWorkBody.js | 9 +++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/redux/actions/componentConfig/fetchPlotDataWork.js b/src/redux/actions/componentConfig/fetchPlotDataWork.js index c0cbdc5d2e..f667e141a3 100644 --- a/src/redux/actions/componentConfig/fetchPlotDataWork.js +++ b/src/redux/actions/componentConfig/fetchPlotDataWork.js @@ -9,8 +9,10 @@ import { fetchWork } from 'utils/work/fetchWork'; const getClusterNames = (state) => { const clusterIds = state.cellSets.hierarchy[0]?.children.map((entry) => entry.key); - const clusterNames = clusterIds?.map((clusterId) => state.cellSets.properties[clusterId].name); + const customClusterIds = state.cellSets.hierarchy[1]?.children.map((entry) => entry.key); + const allClusterIds = clusterIds?.concat(customClusterIds); + const clusterNames = allClusterIds?.map((clusterId) => state.cellSets.properties[clusterId].name); return clusterNames; }; @@ -19,12 +21,17 @@ const fetchPlotDataWork = ( plotUuid, plotType, ) => async (dispatch, getState) => { - const config = getState().componentConfig[plotUuid]?.config ?? initialPlotConfigStates[plotType]; + let config = getState().componentConfig[plotUuid]?.config ?? initialPlotConfigStates[plotType]; const clusterNames = getClusterNames(getState()); const timeout = getTimeoutForWorkerTask(getState(), 'PlotData'); + config = { + ...config, + clusterNames, + }; + try { - const body = generatePlotWorkBody(plotType, config, clusterNames); + const body = generatePlotWorkBody(plotType, config); dispatch({ type: PLOT_DATA_LOADING, diff --git a/src/utils/work/generatePlotWorkBody.js b/src/utils/work/generatePlotWorkBody.js index d5fa2357e3..11d4592ec9 100644 --- a/src/utils/work/generatePlotWorkBody.js +++ b/src/utils/work/generatePlotWorkBody.js @@ -1,6 +1,6 @@ import { plotTypes } from 'utils/constants'; -const composeDotPlotWorkBody = (config, clusterNames) => { +const composeDotPlotWorkBody = (config) => { const [filterGroup, filterKey] = config.selectedPoints.split('/'); return { @@ -9,18 +9,19 @@ const composeDotPlotWorkBody = (config, clusterNames) => { numberOfMarkers: config.nMarkerGenes, customGenesList: config.selectedGenes, groupBy: config.selectedCellSet, - clusterNames, filterBy: { group: filterGroup, key: filterKey || 'All', }, + // clusterNames is used for triggering a work request upon cluster name change + clusterNames: config.clusterNames, }; }; -const generatePlotWorkBody = (plotType, config, clusterNames) => { +const generatePlotWorkBody = (plotType, config) => { switch (plotType) { case plotTypes.DOT_PLOT: - return composeDotPlotWorkBody(config, clusterNames); + return composeDotPlotWorkBody(config); default: { throw new Error('Plot type doesn\'t exist'); } From e34d7b42c6c109d5f94857aff21f0b4063a95118 Mon Sep 17 00:00:00 2001 From: Kristian-A Date: Wed, 13 Jul 2022 14:14:05 +0100 Subject: [PATCH 09/10] Refactor getting cluster ids --- .../actions/componentConfig/fetchPlotDataWork.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/redux/actions/componentConfig/fetchPlotDataWork.js b/src/redux/actions/componentConfig/fetchPlotDataWork.js index f667e141a3..716afbbf77 100644 --- a/src/redux/actions/componentConfig/fetchPlotDataWork.js +++ b/src/redux/actions/componentConfig/fetchPlotDataWork.js @@ -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; }; @@ -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, From 7e3d58502df5299e169595d11f457a2993171669 Mon Sep 17 00:00:00 2001 From: Kristian-A Date: Wed, 13 Jul 2022 14:15:38 +0100 Subject: [PATCH 10/10] Remove console logs --- src/redux/actions/componentConfig/fetchPlotDataWork.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redux/actions/componentConfig/fetchPlotDataWork.js b/src/redux/actions/componentConfig/fetchPlotDataWork.js index 716afbbf77..189213ea98 100644 --- a/src/redux/actions/componentConfig/fetchPlotDataWork.js +++ b/src/redux/actions/componentConfig/fetchPlotDataWork.js @@ -25,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,