Skip to content

Add CI workflow and cache loaded data on web and mobile - #3

Merged
YarinQuapi merged 1 commit into
masterfrom
add-ci-workflow
Nov 9, 2026
Merged

YarinQuapi merged 1 commit into
masterfrom
add-ci-workflow

Conversation

@YarinQuapi

Copy link
Copy Markdown
Owner

What

  • Adds the CI workflow for API, web and mobile (existing commit on this branch).
  • Adds an in-memory stale-while-revalidate cache for GET responses on web (api.ts) and mobile (api.dart). Pages seed their state from the cache via peek(path) and still refetch in the background.
  • Wired into Today, Fasting, Week, Weight, Settings and Permissions on both platforms, plus the food edit form on web.

Why

Every page change started from empty state and showed a loading spinner until the request finished.

Notes for reviewers

  • Cache is cleared on login, logout and 401 (web setStoredToken, mobile setToken) so users never see each other's data.
  • Week is cached per ?on= value; mobile ignores a stale week response if the user has navigated on.
  • Cache is memory-only (lost on reload/restart). After a mutation, other pages may show the old value briefly until their background refresh lands.
  • Food search and recent foods are not cached.
  • Verified: npm run build passes and flutter analyze shows only pre-existing style hints. Not exercised manually in a browser or simulator.

🤖 Generated with Claude Code

GET responses are kept in memory and screens seed their state from them,
then revalidate in the background. The cache is cleared on login, logout
and session expiry.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@YarinQuapi
YarinQuapi merged commit fd02ded into master Nov 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant