2.3 KiB
2.3 KiB
Tasks & Issues
1. Critical Issues
-
1.1 Fix missing
delimport in store/index.js- Line 3 imports
get, setfrom idb-keyval butdelis used on line 13 - Add
delto the import statement - This will cause a ReferenceError when removeItem is called
- Line 3 imports
-
1.2 Fix hydration flag initialization
- The
onRehydrateStoragecallback usesstore.setState()beforestoreis fully initialized - Creates a circular reference issue preventing app from loading
- Options:
- A) Initialize
_hydrated: trueby default (simplest) - B) Use Zustand's persist middleware built-in hydration detection
- C) Move hydration callback outside store creation
- A) Initialize
- The
-
1.3 Consolidate duplicate storage implementation
- Storage is defined in both
store/index.jsANDstore/middleware/persistence.js - The middleware file exports
idbStoragebut it's not being used - Decision needed: Use one or the other, not both
- Storage is defined in both
2. Architectural Improvements
-
2.1 Add error handling
- Add try/catch blocks around IndexedDB operations
- Implement fallback if IndexedDB fails or is unavailable
- Add user feedback for errors (toast notifications?)
-
2.2 Add partialize option to persist middleware
- Currently saves ALL state including
_hydratedflag androute - Should use
partialize: (state) => ({ user: state.user, items: state.items }) - Prevents unnecessary data in IndexedDB
- Currently saves ALL state including
-
2.3 Add basic CSS reset to index.html
- No base styles, margins, or font settings currently
- Consider adding minimal reset or normalize.css
-
2.4 Add loading states for async operations
- No loading indicators for add/remove item operations
- Consider adding optimistic updates
3. Nice to Have
-
3.1 Add TypeScript types (optional)
- JSDoc comments for better IDE support
- Or migrate to .ts files with no-build setup
-
3.2 Add cross-tab synchronization
- README mentions optional
sync.jsmiddleware - Implement BroadcastChannel for cross-tab state sync
- README mentions optional
-
3.3 Add route history management
- Integrate with browser history API
- Support back/forward navigation
-
3.4 Add unit tests
- Test store actions and selectors
- Test component rendering
- Test persistence layer