1.3 KiB
1.3 KiB
title, status
| title | status |
|---|---|
| Fix Cube Session Clear | Completed |
Objectives
- Fix the "Clear Session" functionality in
CubeManagerwhich was failing to fully reset the application state.
Diagnosis
- The previous implementation relied on setting state via props (
setPacks([])), but depending on the timing of React's state updates andApp.tsx's persistence logic, the cleared state might not have been persisted tolocalStoragebefore a reload. - The
handleResetfunction did not explicitly clear thegeneratedPacksandavailableLandskeys fromlocalStorage, assuming the parent component would handle it viauseEffect.
Fix Implemented
- Refactored
handleResetinCubeManager.tsx. - Added explicit
localStorage.removeItem('generatedPacks')andlocalStorage.removeItem('availableLands')calls. - Added explicit calls to reset all local component state (
inputText,processedData, etc.) and their respective storage keys. - Wrapped the logic in a
try/catchblock with toast notifications for feedback. - This ensures a robust, hard reset of the drafting session.
Verification
- User can now click "Clear Session", confirm the dialog, and immediately see a cleared interface and toast success message.
- Reloading the page will confirm the session is truly empty.