zulip/TASKS.md

2.3 KiB

Tasks & Issues

1. Critical Issues

  • 1.1 Fix missing del import in store/index.js COMPLETE

    • Line 3 now imports get, set, del from idb-keyval
    • Used in removeItem function on line 13
    • No more ReferenceError
  • 1.2 Fix hydration flag initialization COMPLETE

    • Implemented Option A: Initialize _hydrated: true by default
    • Removed problematic onRehydrateStorage callback
    • App now loads immediately without hanging on "loading..."
    • Persistence happens in background automatically
  • 1.3 Consolidate duplicate storage implementation COMPLETE

    • Single storage implementation in store/index.js
    • Uses idb-keyval directly with createJSONStorage
    • Clean, simple approach without extra middleware files

2. Architectural Improvements

  • 2.1 Add error handling COMPLETE

    • Added try/catch blocks around all IndexedDB operations (getItem, setItem, removeItem)
    • Implemented fallback: returns null on getItem error, silently fails on setItem/removeItem
    • Added error state to store with auto-clear after 3 seconds
    • Added validation in addItem and removeItem actions
    • Created error-toast component with slide-in animation
    • Toast shows error messages and allows manual dismissal
  • 2.2 Add partialize option to persist middleware COMPLETE

    • Added partialize to exclude _hydrated flag from persistence
    • Only persists: user, items, and route
    • 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