[priority: 3] cancelDesign logic inverted — cancels wrong design slot #78

Closed
opened 2026-05-19 09:11:17 +02:00 by Anexim · 2 comments
Owner

Severity: 3 — Medium
File: src/lib/game/stores/craftingStore.ts and src/lib/game/crafting-actions/design-actions.ts

Description:

if (state.designProgress2 && !state.designProgress) {
  set({ designProgress2: null });
} else {
  set({ designProgress: null });
}

The condition cancels designProgress2 only when designProgress is null, but the else branch cancels designProgress even when designProgress2 exists. This means canceling when both slots are active cancels the first slot, leaving the second orphaned.

Fix: Always cancel designProgress first; only cancel designProgress2 when designProgress is already null.

**Severity:** 3 — Medium **File:** `src/lib/game/stores/craftingStore.ts` and `src/lib/game/crafting-actions/design-actions.ts` **Description:** ```ts if (state.designProgress2 && !state.designProgress) { set({ designProgress2: null }); } else { set({ designProgress: null }); } ``` The condition cancels `designProgress2` only when `designProgress` is null, but the else branch cancels `designProgress` even when `designProgress2` exists. This means canceling when both slots are active cancels the first slot, leaving the second orphaned. **Fix:** Always cancel `designProgress` first; only cancel `designProgress2` when `designProgress` is already null.
Anexim added the ai:todo label 2026-05-19 09:11:17 +02:00
n8n-gitea was assigned by Anexim 2026-05-19 09:11:17 +02:00
Author
Owner

Starting work on cancelDesign logic fix.

Starting work on cancelDesign logic fix.
Author
Owner

Fixed. Cancel logic now always cancels designProgress (slot 1) first. Only cancels designProgress2 (slot 2) when designProgress is already null. Previously the inverted condition could cancel the wrong slot when both were active. Regression tests added.

✅ Fixed. Cancel logic now always cancels `designProgress` (slot 1) first. Only cancels `designProgress2` (slot 2) when `designProgress` is already null. Previously the inverted condition could cancel the wrong slot when both were active. Regression tests added.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#78