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", 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..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 @@ -95,6 +95,7 @@ const DotPlotPage = (props) => { } = useSelector((state) => state.genes.properties.views[plotUuid] || {}); const cellSets = useSelector(getCellSets()); + const { loading: cellSetsLoading, error: cellSetsError, diff --git a/src/redux/actions/componentConfig/fetchPlotDataWork.js b/src/redux/actions/componentConfig/fetchPlotDataWork.js index b93a655561..189213ea98 100644 --- a/src/redux/actions/componentConfig/fetchPlotDataWork.js +++ b/src/redux/actions/componentConfig/fetchPlotDataWork.js @@ -7,10 +7,30 @@ 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 config = getState().componentConfig[plotUuid]?.config ?? initialPlotConfigStates[plotType]; +const getClusterNames = (state) => { + const clusterIds = state.cellSets.hierarchy.reduce( + (acc, cellSet) => [...acc, ...cellSet.children.map((entry) => entry.key)], + [], + ); + + const clusterNames = clusterIds?.map((clusterId) => state.cellSets.properties[clusterId].name); + return clusterNames; +}; + +const fetchPlotDataWork = ( + experimentId, + plotUuid, + plotType, +) => async (dispatch, getState) => { + 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); diff --git a/src/utils/work/fetchWork.js b/src/utils/work/fetchWork.js index fe8d8bf9db..e123628ecd 100644 --- a/src/utils/work/fetchWork.js +++ b/src/utils/work/fetchWork.js @@ -106,7 +106,12 @@ const fetchWork = async ( getState, optionals = {}, ) => { - const { extras = undefined, timeout = 180, broadcast = false } = optionals; + const { + extras = undefined, + timeout = 180, + broadcast = false, + } = optionals; + const backendStatus = getBackendStatus(experimentId)(getState()).status; const { environment } = getState().networkResources; @@ -135,7 +140,11 @@ const fetchWork = async ( } const ETag = createObjectHash({ - experimentId, body, qcPipelineStartDate, extras, cacheUniquenessKey, + experimentId, + body, + qcPipelineStartDate, + extras, + cacheUniquenessKey, }); // First, let's try to fetch this information from the local cache. diff --git a/src/utils/work/generatePlotWorkBody.js b/src/utils/work/generatePlotWorkBody.js index 62d4bc34a7..11d4592ec9 100644 --- a/src/utils/work/generatePlotWorkBody.js +++ b/src/utils/work/generatePlotWorkBody.js @@ -13,6 +13,8 @@ const composeDotPlotWorkBody = (config) => { group: filterGroup, key: filterKey || 'All', }, + // clusterNames is used for triggering a work request upon cluster name change + clusterNames: config.clusterNames, }; };