variable / @typed/async-data

stopLoading

Stops loading or refreshing without discarding optimistic history.

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

Import

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

Signatures

export declare const stopLoading: <A, E>(data: AsyncData<A, E>) => AsyncData<A, E>;

Why

Removing progress settles success and failure while leaving initial or loading state semantics predictable. 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, stopLoading, success } from "@typed/async-data"
const settled = stopLoading(startLoading(success("cached")))

Source