The previous \`importOne\` only fetched page 1 of /v1/workouts and errored with \"not found on page 1\" if the workout wasn't there — silently breaking import for any workout older than roughly the most recent 30 entries (per_page default). Webhook-driven imports happen to land on page 1 by definition, so this only bit on user-initiated catch-up imports of older workouts. Now we paginate forward, using the \`total / per_page\` returned by page 1 to compute a stop condition, with a \`MAX_PAGES=100\` ceiling so a misbehaving API can't loop us. We also stop early on an empty page. Tests: - new pagination case (workout on page 2, expect 2 fetch calls) - new \"not found on any page\" case Full repo: pnpm typecheck, pnpm lint, pnpm test all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| app | ||
| public | ||
| .env.example | ||
| Dockerfile | ||
| package.json | ||
| react-router.config.ts | ||
| server.ts | ||
| tsconfig.json | ||
| vite.config.ts | ||
| vitest.config.ts | ||