fix: add cache: 'no-store' to all fetch to prevent empty 304#1457
Conversation
PR Validation ResultsChange Detection
✅ All checks passed. Thank you! |
There was a problem hiding this comment.
Code Review
This pull request addresses issue #1353 by adding cache: 'no-store' to various fetch requests in the mobile application. This forces React Native's whatwg-fetch polyfill to append a _ cache-buster parameter to GET requests, preventing native HTTP caches from returning empty 304 responses. The server-side Zod schemas and tests have also been updated to tolerate this new parameter. Feedback on these changes includes conditionally applying the cache: 'no-store' option only to GET requests in apiClient.ts (and updating tests accordingly) to avoid unexpected side effects on state-changing requests, as well as wrapping a fetch call in OnboardingScreen.tsx in a try...finally block to guarantee clearTimeout is executed even if the request fails.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Tip
Help us review and merge your PR faster!
Please ensure you have completed the Checklist below.
For Frontend changes, please run
pnpm run validateto check for any errors.PRs that include tests and clear screenshots are highly preferred!
Note: AI-generated descriptions must be manually edited for conciseness. Do not paste raw AI summaries.
Description
Fixes an issue where the iOS app could show 'Failed to Load.' This adds cache: 'no-store' to every GET requst which makes the polyfill append a timestamp query parameter for cache busting. This required me to add the parameter to the two strict zod schemas we have (exercise related.)
Linked Issue: Closes #1353 again
How to Test
PR Type
Checklist
All PRs:
New features only:
Frontend changes (
SparkyFitnessFrontend/):pnpm run validateand it passes.en) translation file.Backend changes (
SparkyFitnessServer/):rls_policies.sqlfor any new user-specific tables.UI changes (components, screens, pages):
Mobile changes (
SparkyFitnessMobile/):Screenshots
Click to expand
Before
After
Notes for Reviewers