mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-21 01:57:41 +02:00
Fix plate-clear button unclickable after second print (#912)
The clearPlateMutation.isSuccess state from React Query persisted after the first successful plate clear. When the next print finished, the stale isSuccess rendered the static confirmation instead of the clickable button. Reset mutation state when printer leaves FINISH/FAILED.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { Clock, Calendar, ChevronRight, Loader2, CircleCheck } from 'lucide-react';
|
||||
import { Link } from 'react-router-dom';
|
||||
@@ -41,6 +42,14 @@ export function PrinterQueueWidget({ printerId, printerModel, printerState, plat
|
||||
},
|
||||
});
|
||||
|
||||
// Reset mutation state when printer starts a new print cycle so the button
|
||||
// is clickable again when the next print finishes (fixes #912)
|
||||
useEffect(() => {
|
||||
if (printerState !== 'FINISH' && printerState !== 'FAILED') {
|
||||
clearPlateMutation.reset();
|
||||
}
|
||||
}, [printerState]);
|
||||
|
||||
// Filter queue to items this printer can actually print (filament type + color check)
|
||||
const compatibleQueue = queue ? filterCompatibleQueueItems(queue, loadedFilamentTypes, loadedFilaments) : undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user