Просмотр исходного кода

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.
maziggy 5 месяцев назад
Родитель
Сommit
502959a0df

+ 3 - 0
CHANGELOG.md

@@ -4,6 +4,9 @@ All notable changes to Bambuddy will be documented in this file.
 
 ## [0.2.3b3] - Unreleased
 
+### Fixed
+- **"Build Plate Cleared" Button Unclickable After Second Print** ([#912](https://github.com/maziggy/bambuddy/issues/912)) — After completing the first queued print and confirming the plate was cleared, the "Build plate cleared — ready for next print" button became unresponsive after the second print finished. The React Query mutation's `isSuccess` state persisted from the first plate-clear confirmation, causing the component to render the static "Plate Ready" confirmation instead of the clickable button. The mutation state is now reset when the printer leaves the FINISH/FAILED state, so the button works correctly on every print cycle.
+
 ## [0.2.3b2] - 2026-04-08
 
 ### New Features

+ 9 - 0
frontend/src/components/PrinterQueueWidget.tsx

@@ -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;
 

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
static/assets/index-CNOL7dUq.js


+ 1 - 1
static/index.html

@@ -23,7 +23,7 @@
 
     <!-- Splash screens for iOS -->
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
-    <script type="module" crossorigin src="/assets/index-DMDXAsuP.js"></script>
+    <script type="module" crossorigin src="/assets/index-CNOL7dUq.js"></script>
     <link rel="stylesheet" crossorigin href="/assets/index-CA19cW_f.css">
   </head>
   <body>

Некоторые файлы не были показаны из-за большого количества измененных файлов