diff --git a/src/renderer/routes/test_sequencer_panel/components/data-table/SequenceTable.tsx b/src/renderer/routes/test_sequencer_panel/components/data-table/SequenceTable.tsx index c44b2e972..9273ad247 100644 --- a/src/renderer/routes/test_sequencer_panel/components/data-table/SequenceTable.tsx +++ b/src/renderer/routes/test_sequencer_panel/components/data-table/SequenceTable.tsx @@ -273,18 +273,17 @@ export function SequenceTable() { toast.error("Sequence name must be unique"); return; } - setSequences( - [...sequences].map((seq, idx) => { - if (idx === renameForIdx.current) { - return { - ...seq, - project: { ...seq.project, name: newName }, - testSequenceUnsaved: true, - }; - } - return seq; - }), - ); + if (newName === "") { + toast.error("Sequence name cannot be empty"); + return; + } + setSequences(produce(sequences, (draft) => { + const seq = draft[renameForIdx.current]; + seq.project.name = newName; + seq.testSequenceUnsaved = true; + })) + setIsRenameDescModalOpen(false); + setIsRenameNameModalOpen(false); }; const [isRenameNameModalOpen, setIsRenameNameModalOpen] = useState(false); diff --git a/src/renderer/routes/test_sequencer_panel/utils/SequenceHandler.ts b/src/renderer/routes/test_sequencer_panel/utils/SequenceHandler.ts index 4ef127e07..a123bf72f 100644 --- a/src/renderer/routes/test_sequencer_panel/utils/SequenceHandler.ts +++ b/src/renderer/routes/test_sequencer_panel/utils/SequenceHandler.ts @@ -85,7 +85,7 @@ export async function saveSequence( } // Set the sequence as saved stateManager.setSequences( - [...stateManager.sequences].map((seq) => { + stateManager.sequences.map((seq) => { if (seq.project.name === sequence.name) { return { ...seq, testSequenceUnsaved: false }; } @@ -121,7 +121,7 @@ export async function saveSequences( return err(res.error); } stateManager.setSequences( - [...stateManager.sequences].map((seq) => ({ + stateManager.sequences.map((seq) => ({ ...seq, testSequenceUnsaved: false, })),