Recover from tracking-page loading failures
TrackingPage calls fetch and resp.json in an effect without catching errors; a rejection prevents setLoading(false). Unsuccessful HTTP responses become ticket-not-found, although the route also returns 500 when the messages query fails.
- Estimated size
- S · 3–5 hours
- Skills
- React · Next.js · TypeScript
Files and evidence
- YagoLagrottiBracco/andre/src/app/acompanhamento/[token]/page.tsxTarget file ·
41b801131ffa· L31–L54 - YagoLagrottiBracco/andre/src/app/api/public/ticket/route.tsContext ·
41b801131ffa· L5–L24
Step-by-step acceptance criteria
- Reproduce rejected fetch and invalid JSON; end the loading state for every outcome, including exceptions.
- Distinguish 404 from network errors or 500 and provide an accessible retry for transient failures.
- When the token changes, clear previous data and cancel or ignore stale responses; do not log tokens or messages.
- Cover 200, 404, 500, offline, invalid JSON, retry and token changes using synthetic data only.