[Medium] [Bug] [Crafting] Design state lost when navigating away from Crafting tab #366

Closed
opened 2026-06-10 19:29:28 +02:00 by Anexim · 2 comments
Owner

Severity: Medium
Type: Bug
Store: useCraftingStore / CraftingTab.tsx

Steps to reproduce:

  1. Go to Crafting tab → Enchanter sub-tab
  2. Select Basic Staff as equipment type
  3. Add an effect (e.g., Mana Bolt)
  4. Enter a design name (e.g., "Test Design")
  5. Navigate away to another tab (e.g., Debug tab)
  6. Navigate back to Crafting tab → Enchanter sub-tab

Expected:

  • The design form should preserve the selected equipment type, chosen effects, and design name
  • Started designs should complete after the required time even while on other tabs

Actual:

  • The design form resets to "Select an equipment type first"
  • The design name is cleared
  • Effects selection is lost
  • "Saved Designs (0)" shows even for designs that were started before navigating away

Notes:

  • The 3-step enchanting flow (Design → Prepare → Apply) appears to not persist in-progress work across tab navigation
  • This could be an issue with the crafting store not persisting intermediate UI state, or the design not being saved to the store until explicitly completed
**Severity:** Medium **Type:** Bug **Store:** `useCraftingStore` / `CraftingTab.tsx` **Steps to reproduce:** 1. Go to Crafting tab → Enchanter sub-tab 2. Select Basic Staff as equipment type 3. Add an effect (e.g., Mana Bolt) 4. Enter a design name (e.g., "Test Design") 5. Navigate away to another tab (e.g., Debug tab) 6. Navigate back to Crafting tab → Enchanter sub-tab **Expected:** - The design form should preserve the selected equipment type, chosen effects, and design name - Started designs should complete after the required time even while on other tabs **Actual:** - The design form resets to "Select an equipment type first" - The design name is cleared - Effects selection is lost - "Saved Designs (0)" shows even for designs that were started before navigating away **Notes:** - The 3-step enchanting flow (Design → Prepare → Apply) appears to not persist in-progress work across tab navigation - This could be an issue with the crafting store not persisting intermediate UI state, or the design not being saved to the store until explicitly completed
Anexim added the ai:todo label 2026-06-10 19:29:28 +02:00
n8n-gitea was assigned by Anexim 2026-06-10 19:29:28 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-11 11:50:13 +02:00
Author
Owner

Starting investigation. The bug is about design form state (selected equipment type, effects, design name) being lost when navigating away from the Crafting tab and back. Will examine the CraftingTab component and EnchantmentDesigner to understand the state management.

Starting investigation. The bug is about design form state (selected equipment type, effects, design name) being lost when navigating away from the Crafting tab and back. Will examine the CraftingTab component and EnchantmentDesigner to understand the state management.
Anexim added ai:done and removed ai:in-progress labels 2026-06-11 11:55:17 +02:00
Author
Owner

Fixed. Root cause: EnchanterSubTab used React useState for form state (equipment type, effects, design name), which gets destroyed when the Crafting tab unmounts during tab navigation.

Fix: Both EnchantmentDesigner and EnchanterSubTab now read/write selection state directly from the persisted useCraftingStore (enchantmentSelection field), which survives tab unmounts via Zustand persist middleware.

Changes:

  • EnchantmentDesigner — no longer receives selection props, reads from store
  • EnchanterSubTab — removed local useState for selection state, uses store
  • types.ts — removed unused EnchantmentDesignerProps interface

All 1158 tests pass, pre-commit hook clean.

Fixed. Root cause: `EnchanterSubTab` used React `useState` for form state (equipment type, effects, design name), which gets destroyed when the Crafting tab unmounts during tab navigation. Fix: Both `EnchantmentDesigner` and `EnchanterSubTab` now read/write selection state directly from the persisted `useCraftingStore` (`enchantmentSelection` field), which survives tab unmounts via Zustand persist middleware. Changes: - `EnchantmentDesigner` — no longer receives selection props, reads from store - `EnchanterSubTab` — removed local `useState` for selection state, uses store - `types.ts` — removed unused `EnchantmentDesignerProps` interface All 1158 tests pass, pre-commit hook clean.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#366