Summary
Persist authenticated wallet session state safely so users do not need to reconnect or re-authenticate on every page refresh.
Current Behaviour
Session data is fetched from the API based on the connected wallet state, but the frontend does not clearly model session expiry, refresh, or invalidation behaviour.
Expected Behaviour
The app should preserve valid sessions across reloads, detect expired sessions, and provide a clean path to refresh or clear stale authentication state.
Suggested Implementation
Add a session utility layer that stores only safe metadata client-side and relies on the backend for authoritative session validation. Integrate it with React Query cache invalidation, wallet disconnect events, and admin guard checks.
Files or Areas Likely Affected
lib/api/types.ts
lib/api/live.ts
lib/api/mock.ts
components/admin-guard.tsx
components/wallet/connect-button.tsx
lib/wallet/providers.tsx
Acceptance Criteria
Additional Notes
Assumption: live mode will rely on backend cookies or tokens rather than trusting client-only session data.
Summary
Persist authenticated wallet session state safely so users do not need to reconnect or re-authenticate on every page refresh.
Current Behaviour
Session data is fetched from the API based on the connected wallet state, but the frontend does not clearly model session expiry, refresh, or invalidation behaviour.
Expected Behaviour
The app should preserve valid sessions across reloads, detect expired sessions, and provide a clean path to refresh or clear stale authentication state.
Suggested Implementation
Add a session utility layer that stores only safe metadata client-side and relies on the backend for authoritative session validation. Integrate it with React Query cache invalidation, wallet disconnect events, and admin guard checks.
Files or Areas Likely Affected
lib/api/types.tslib/api/live.tslib/api/mock.tscomponents/admin-guard.tsxcomponents/wallet/connect-button.tsxlib/wallet/providers.tsxAcceptance Criteria
Additional Notes
Assumption: live mode will rely on backend cookies or tokens rather than trusting client-only session data.