Skip to content

Commit

Permalink
35447 Changing the run item name throws an error
Browse files Browse the repository at this point in the history
- I was unable to replicate the error
- Changing the run item name should be possible
- Removing the run item name should also be possible now
  • Loading branch information
johnphan96 committed Dec 19, 2024
1 parent 4190f63 commit 0648f59
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -946,19 +946,7 @@ export function getMolecularAnalysisRunColumns(
defaultValue={original.molecularAnalysisRunItem?.name}
onChange={(event: ChangeEvent<HTMLInputElement>) => {
setMolecularAnalysisRunItemNames?.(
(molecularAnalysisRunItemNames) => {
const molecularAnalysisRunItemNamesMap =
molecularAnalysisRunItemNames;
if (
original?.materialSampleSummary?.id &&
event.target.value
) {
molecularAnalysisRunItemNamesMap[
original?.materialSampleSummary?.id
] = event.target.value;
}
return molecularAnalysisRunItemNamesMap;
}
handleMolecularAnalysisRunItemNames(original, event)
);
}}
/>
Expand Down Expand Up @@ -1059,19 +1047,7 @@ export function getMolecularAnalysisRunColumns(
defaultValue={original.molecularAnalysisRunItem?.name}
onChange={(event: ChangeEvent<HTMLInputElement>) => {
setMolecularAnalysisRunItemNames?.(
(molecularAnalysisRunItemNames) => {
const molecularAnalysisRunItemNamesMap =
molecularAnalysisRunItemNames;
if (
original?.materialSampleSummary?.id &&
event.target.value
) {
molecularAnalysisRunItemNamesMap[
original?.materialSampleSummary?.id
] = event.target.value;
}
return molecularAnalysisRunItemNamesMap;
}
handleMolecularAnalysisRunItemNames(original, event)
);
}}
/>
Expand Down Expand Up @@ -1172,19 +1148,7 @@ export function getMolecularAnalysisRunColumns(
defaultValue={original.molecularAnalysisRunItem?.name}
onChange={(event: ChangeEvent<HTMLInputElement>) => {
setMolecularAnalysisRunItemNames?.(
(molecularAnalysisRunItemNames) => {
const molecularAnalysisRunItemNamesMap =
molecularAnalysisRunItemNames;
if (
original?.materialSampleSummary?.id &&
event.target.value
) {
molecularAnalysisRunItemNamesMap[
original?.materialSampleSummary?.id
] = event.target.value;
}
return molecularAnalysisRunItemNamesMap;
}
handleMolecularAnalysisRunItemNames(original, event)
);
}}
/>
Expand All @@ -1206,4 +1170,18 @@ export function getMolecularAnalysisRunColumns(
"metagenomics-batch-item": METAGENOMICS_BATCH_ITEM_COLUMNS
};
return MOLECULAR_ANALYSIS_RUN_COLUMNS_MAP[type];

function handleMolecularAnalysisRunItemNames(
original: SequencingRunItem,
event: ChangeEvent<HTMLInputElement>
): SetStateAction<Record<string, string>> {
return (molecularAnalysisRunItemNames) => {
const molecularAnalysisRunItemNamesMap = molecularAnalysisRunItemNames;
if (original?.materialSampleSummary?.id) {
molecularAnalysisRunItemNamesMap[original?.materialSampleSummary?.id] =
event.target.value;
}
return molecularAnalysisRunItemNamesMap;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -715,16 +715,14 @@ export function useGenericMolecularAnalysisRun({
const molecularAnalysisRunItemName = item.materialSampleSummary?.id
? molecularAnalysisRunItemNames[item.materialSampleSummary?.id]
: undefined;
if (molecularAnalysisRunItemName) {
molecularAnalysisRunItemSaveArgs.push({
molecularAnalysisRunItemSaveArgs.push({
type: "molecular-analysis-run-item",
resource: {
id: item.molecularAnalysisRunItemId,
type: "molecular-analysis-run-item",
resource: {
id: item.molecularAnalysisRunItemId,
type: "molecular-analysis-run-item",
name: molecularAnalysisRunItemName
}
});
}
name: molecularAnalysisRunItemName
}
});
});
if (molecularAnalysisRunItemSaveArgs.length) {
await save(molecularAnalysisRunItemSaveArgs, {
Expand Down

0 comments on commit 0648f59

Please sign in to comment.