SNAPSHOT ingestion
The simplest of Flux's four ingestion types — for a channel that is always exactly one object. No array handling, no byte-budget eviction, no pagination — just cache it, hydrate it, and replace it wholesale on every update.
- A store already registered via register() — see api/register
- Familiarity with the other three types — see ingestion/collection_all, ingestion/lru, ingestion/paginated
Basic usage
ingestionType: 'SNAPSHOT' on any channel whose data is a single object rather than a collection.What qualifies as a SNAPSHOT
How it's cached
idbKey, with none of the per-item key splitting or eviction accounting that LRU channels require.The same dispatch path, every time
Realtime updates replace the object wholesale
event.data is handed to the same hydrateState function bootstrap and IDB hydration use.Since Flux doesn't merge partial diffs for SNAPSHOT channels itself, make sure your realtime adapter normalizes each event's data field to the complete object, not just the changed fields — the Supabase adapter's partial-diff-vs-full-row handling is covered in adapters/supabase.
Choosing the right ingestion type
COLLECTION_ALL the moment your data becomes a bounded array rather than a single object.Because updates overwrite the root snapshot envelope directly, memory footprint remains strictly flat. No mutation logs or tombstone markers accumulate in IndexedDB for single-record entities.
For bounded arrays, see ingestion/collection_all. For byte-budget-capped detail pages, see ingestion/lru. For configuring ingestionType alongside the rest of a registration, see api/register.