[Medium] [Bug] Earth element desync between localStorage and UI after Unlock All #338
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?
Bug: Earth element desync between localStorage and UI
Steps to reproduce
mana-loop-mana→elements.earthExpected
All elements including
earthshowunlocked: truein localStorage, matching the UI.Actual
The UI shows earth as unlocked (with 0/10 and a +10 button), but localStorage shows
earth: { unlocked: false, ... }. This is a desync between the persisted state and the in-memory state.Root cause
The
handleUnlockAllfunction inElementDebugSection.tsxcallshandleUnlockElement(id)which callsuseManaStore.getState().unlockElement(element, 0). TheunlockElementfunction updates the in-memory state but the persist middleware may not be writing it correctly for all elements, or there's a race condition where the earth element's unlocked state is not being persisted.Store
useManaStore→manaStore.ts→unlockElementactionStarting work. Investigating Earth element desync between localStorage and UI after Unlock All.