Shows a feed as it was left when the user comes back to it, instead of fetching it again. It keeps the feed's loaded pages and scroll position in sessionStorage.

Functions

f
useFeedCache<T>(
key: string,
hydrateItem: (raw: T) => T
): UseFeedCacheResult<T>

Returns the feed saved under key and a way to save it. The feed pages and useUserDumpFeed use it. key must tell apart every list whose items differ; the viewer is added to it here, since they see their own private items. hydrateItem restores what JSON lost, such as dates. A full or blocked storage is ignored.

Interfaces

I
FeedCacheEntry

Stored as JSON by useFeedCache's saveState, and read back by the hook when the page is next reached by going back.

I
UseFeedCacheResult

Returned by useFeedCache to a feed page.

Type Aliases

T
SavedList<T> = Pick<PagedList<T>, "items" | "page" | "hasMore">

Passed to useFeedCache's saveState by the feed pages, from the list they hold, without its loading flag.