Jelajahi Sumber

fix(printer): suppress "not homed" re-prompt after Auto Home (#1052 follow-up)

  The bed-jog "not homed" warning modal was gated on a session-scoped
  "warned" flag set only by the "Move anyway" button. Clicking "Auto
  Home" sent the G28 and closed the modal but never set the flag, so the
  next jog click in the same session re-prompted — even though the
  printer was now homed.

  The homeAxes mutation's onSuccess handler now flips the same
  `bambuddy.bedJog.warned.<printerId>` sessionStorage flag. The warning
  still fires once per printer per session (intended safety guard,
  cleared on restart), but not repeatedly after a successful auto-home.

(cherry picked from commit 1de4e409b0607a6e1ecec1a23a0cfab1064fe29c)
maziggy 4 bulan lalu
induk
melakukan
af30708a46
2 mengubah file dengan 9 tambahan dan 2 penghapusan
  1. 1 1
      CHANGELOG.md
  2. 8 1
      frontend/src/pages/PrintersPage.tsx

File diff ditekan karena terlalu besar
+ 1 - 1
CHANGELOG.md


+ 8 - 1
frontend/src/pages/PrintersPage.tsx

@@ -1878,7 +1878,14 @@ function PrinterCard({
 
 
   const homeAxesMutation = useMutation({
   const homeAxesMutation = useMutation({
     mutationFn: (axes: 'z' | 'xy' | 'all') => api.homeAxes(printer.id, axes),
     mutationFn: (axes: 'z' | 'xy' | 'all') => api.homeAxes(printer.id, axes),
-    onSuccess: () => showToast(t('printers.bedJog.homingStarted')),
+    onSuccess: () => {
+      // Flip the session-scoped "warned" flag so the next bed-jog click doesn't re-prompt
+      // the not-homed modal. The flag is the same one "Move anyway" sets; after a successful
+      // auto-home request the printer is (or will shortly be) in a known-homed state, so
+      // prompting again in the same session is noise — #1052 follow-up.
+      try { sessionStorage.setItem(`bambuddy.bedJog.warned.${printer.id}`, '1'); } catch { /* ignore */ }
+      showToast(t('printers.bedJog.homingStarted'));
+    },
     onError: (error: Error) =>
     onError: (error: Error) =>
       showToast(error.message || t('printers.toast.failedToSendCommand'), 'error'),
       showToast(error.message || t('printers.toast.failedToSendCommand'), 'error'),
   });
   });

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini