fix: auto-select first plate for multi-plate files in print modal (#394)

When scheduling a multi-plate file from the file manager, the modal
allowed submission without selecting a plate. Now auto-selects the
first plate by default and enforces plate selection for both archive
and library files.
This commit is contained in:
maziggy
2026-02-16 09:11:08 +01:00
parent df839bb762
commit cf0287d5c8
5 changed files with 390 additions and 389 deletions
+5 -5
View File
@@ -251,9 +251,9 @@ export function PrintModal({
setPerPrinterConfigs
);
// Auto-select first plate for single-plate files
// Auto-select first plate when plates load (single or multi-plate)
useEffect(() => {
if (platesData?.plates?.length === 1 && !selectedPlate) {
if (platesData?.plates && platesData.plates.length >= 1 && !selectedPlate) {
setSelectedPlate(platesData.plates[0].index);
}
}, [platesData, selectedPlate]);
@@ -528,11 +528,11 @@ export function PrintModal({
// Model-based assignment only works in queue modes (not immediate reprint)
if (assignmentMode === 'model' && mode === 'reprint') return false;
// For multi-plate archive files, need a selected plate (library files skip this)
if (!isLibraryFile && isMultiPlate && !selectedPlate) return false;
// For multi-plate files, need a selected plate
if (isMultiPlate && !selectedPlate) return false;
return true;
}, [selectedPrinters.length, assignmentMode, targetModel, mode, isMultiPlate, selectedPlate, isPending, isLibraryFile]);
}, [selectedPrinters.length, assignmentMode, targetModel, mode, isMultiPlate, selectedPlate, isPending]);
// Modal title and action button text based on mode
const getModalConfig = () => {