[Medium] [Bug] [Crafting] Design state lost when navigating away from Crafting tab #366
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Medium
Type: Bug
Store:
useCraftingStore/CraftingTab.tsxSteps to reproduce:
Expected:
Actual:
Notes:
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.
Fixed. Root cause:
EnchanterSubTabused ReactuseStatefor form state (equipment type, effects, design name), which gets destroyed when the Crafting tab unmounts during tab navigation.Fix: Both
EnchantmentDesignerandEnchanterSubTabnow read/write selection state directly from the persisteduseCraftingStore(enchantmentSelectionfield), which survives tab unmounts via Zustand persist middleware.Changes:
EnchantmentDesigner— no longer receives selection props, reads from storeEnchanterSubTab— removed localuseStatefor selection state, uses storetypes.ts— removed unusedEnchantmentDesignerPropsinterfaceAll 1158 tests pass, pre-commit hook clean.