Skip to content

Commit 9338c49

Browse files
authored
Bug: error dialog shown when adding custom data to DE (#664)
1 parent 500be78 commit 9338c49

File tree

1 file changed

+30
-20
lines changed
  • frontend/packages/@depmap/data-explorer-2/src/components/DataExplorerPage/components/ConfigurationPanel

1 file changed

+30
-20
lines changed

frontend/packages/@depmap/data-explorer-2/src/components/DataExplorerPage/components/ConfigurationPanel/AnalysisResult.tsx

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -206,33 +206,43 @@ function AnalysisResult({ plot, dispatch }: Props) {
206206
result.data[0].vectorId.split("/")?.[1]
207207
);
208208

209-
const dimTypes = await cached(breadboxAPI).getDimensionTypes();
210-
const datasets = await cached(breadboxAPI).getDatasets();
211-
const metadataDataset = resolveMetadataGivenId(
212-
sliceType!,
213-
dimTypes,
214-
datasets
215-
);
216-
217-
if (!metadataDataset) {
218-
window.console.warn(
219-
"Could not find metadata dataset for dimension type",
220-
`"${sliceType}".`
209+
const vars: Record<string, object> = {};
210+
211+
if (sliceType !== null) {
212+
const bb = cached(breadboxAPI);
213+
const datasets = await bb.getDatasets();
214+
const dimTypes = await bb.getDimensionTypes();
215+
const metadataDataset = resolveMetadataGivenId(
216+
sliceType,
217+
dimTypes,
218+
datasets
221219
);
222-
return;
220+
221+
if (!metadataDataset) {
222+
window.console.warn(
223+
"Could not find metadata dataset for dimension type",
224+
`"${sliceType}".`
225+
);
226+
return;
227+
}
228+
229+
vars.entity_label = {
230+
dataset_id: metadataDataset,
231+
identifier_type: "column" as const,
232+
identifier: "label",
233+
};
223234
}
224235

225236
const context = {
226237
name: slice_label,
227238
dimension_type: sliceType,
228-
expr: { "==": [{ var: "entity_label" }, slice_label] },
229-
vars: {
230-
entity_label: {
231-
dataset_id: metadataDataset,
232-
identifier_type: "column" as const,
233-
identifier: "label",
234-
},
239+
expr: {
240+
"==": [
241+
{ var: sliceType ? "entity_label" : "given_id" },
242+
slice_label,
243+
],
235244
},
245+
vars,
236246
};
237247

238248
dispatch({

0 commit comments

Comments
 (0)