variable / @typed/async-data

startLoading

Starts loading while preserving successful, failed, and optimistic history.

Package version
1.0.0-beta.7
Category
Refresh transitions
Since
1.0.0

Import

import { startLoading } from "@typed/async-data";

Signatures

export declare const startLoading: <A, E>(data: AsyncData<A, E>, progress?: Progress) => AsyncData<A, E>;

Why

Refreshes should keep usable values or causes visible, and optimistic layers must remain in their original order. Cyclic history throws TypeError.

Ownership and lifetime

This pure transformation acquires no resources and returns new plain wrappers where rebuilding is needed.

Examples

import { startLoading, success } from "@typed/async-data"
const refreshing = startLoading(success("cached"))

Source