Skip to content

fix: add Zustand persistence to loans store #38

Description

@EmeditWeb

Problem

The loans.store.ts (38 lines total) has NO persistence middleware. The simulatedAmount and simulatedTerm fields (lines 14-16) are in-memory only. All simulation results and loan data are lost when the app restarts.

User impact: Every time a user restarts the app, their loan simulation results are gone. Active loans fetched from API are also not cached offline.

Root Cause

Persistence was not added to the loans store during implementation.

What To Build

  1. Add Zustand persist middleware to loans.store.ts
  2. Use AsyncStorage as the storage engine (consistent with other stores)
  3. Whitelist simulatedAmount and simulatedTerm for persistence
  4. Add setLoans persistence (cache active loans)
  5. Add loading state while persisted data hydrates

Files To Touch

  • stores/loans.store.ts — add persist middleware

Acceptance Criteria

  • Simulated amount/term survive app restart
  • Active loans cached to AsyncStorage
  • Loading state during persistence hydration
  • Clean persistence on sign-out

Mandatory Checks

  • context/ files read
  • npm test passes
  • PR references this issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions