61 lines
2.3 KiB
Markdown
61 lines
2.3 KiB
Markdown
|
|
# Tasks & Issues
|
||
|
|
|
||
|
|
## 1. Critical Issues
|
||
|
|
|
||
|
|
- [ ] **1.1 Fix missing `del` import in store/index.js**
|
||
|
|
- Line 3 imports `get, set` from idb-keyval but `del` is used on line 13
|
||
|
|
- Add `del` to the import statement
|
||
|
|
- This will cause a ReferenceError when removeItem is called
|
||
|
|
|
||
|
|
- [ ] **1.2 Fix hydration flag initialization**
|
||
|
|
- The `onRehydrateStorage` callback uses `store.setState()` before `store` is fully initialized
|
||
|
|
- Creates a circular reference issue preventing app from loading
|
||
|
|
- **Options:**
|
||
|
|
- A) Initialize `_hydrated: true` by default (simplest)
|
||
|
|
- B) Use Zustand's persist middleware built-in hydration detection
|
||
|
|
- C) Move hydration callback outside store creation
|
||
|
|
|
||
|
|
- [ ] **1.3 Consolidate duplicate storage implementation**
|
||
|
|
- Storage is defined in both `store/index.js` AND `store/middleware/persistence.js`
|
||
|
|
- The middleware file exports `idbStorage` but it's not being used
|
||
|
|
- **Decision needed:** Use one or the other, not 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 `_hydrated` flag and `route`
|
||
|
|
- Should use `partialize: (state) => ({ user: state.user, items: state.items })`
|
||
|
|
- Prevents unnecessary data in IndexedDB
|
||
|
|
|
||
|
|
- [ ] **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.js` middleware
|
||
|
|
- Implement BroadcastChannel for cross-tab state sync
|
||
|
|
|
||
|
|
- [ ] **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
|