---
name: resilient-fetch
description: "Keep network requests correct under latency and failure. Use for fetch, AbortController, retry."
---

# Устойчивые запросы

Keep network requests correct under latency and failure.

## Implementation decisions

1. Abort stale searches and on unmount; associate results with the request that produced them.
2. Check response.ok and apply a bounded timeout.
3. Retry transient failures only; mutations need idempotency before retry. Respect Retry-After.
4. Retain previous results while loading when they cannot misrepresent current state.

## Working source

Read [components/demos.tsx](../webcraft-shared/source/components/demos.tsx) when implementing this capability. The example belongs to the WEBCRAFT React/Three.js playground except the Python commerce starter, which runs without third-party dependencies. Use [shared catalog](../webcraft-shared/source/lib/catalog.ts) only to resolve related examples. Adapt the source to the target framework and preserve existing project conventions.

## Verify observable behavior

- An old response cannot replace a new result.
- Offline errors offer retry.
- Abort does not produce a false user error.

## Scope

Use only the parts relevant to the requested task. This skill does not grant permission to publish, spend money, change account access or expose secrets. The original brief and environment rules remain authoritative.

Live example: https://webcraft-skill-library.undrgrnd.chatgpt.site/demos/api

Version 2.0.0 · Original WEBCRAFT content · MIT
