Reactivity

isPending

Returns whether the reactive reads inside fn depend on an in-flight value change that has not been revealed.


Import

import { isPending } from "solid-js";

Type signature

function isPending(fn: () => any): boolean;

Parameters

fn

  • Type: () => any

Expression to probe. Read the values in question inside it.


Return value

true while a read inside fn depends on a change that has not committed yet


Examples

const [query, setQuery] = createSignal("");
const results = createMemo(() => searchProducts(query()));
const stale = createMemo(() => isPending(results));
setQuery("shoes");
// stale() is true until the new results land, while results() keeps
// serving the previous list — dim it instead of showing a spinner.

Dim stale results while a new answer loads

const [query, setQuery] = createSignal("");
const results = createMemo(() => searchProducts(query()));
<ul class={{ stale: isPending(results) }}>
<For each={results()}>{(product) => <li>{product.name}</li>}</For>
</ul>;

Caveats

  • Reports on updates to a value that exists. Before a first value, the read inside fn follows the surrounding Loading path.
  • A bare refresh() does not flip isPending; pair it with affects() to make the re-ask visible.

Common problems


Learn more

Last updated: 10/20/26, 7:52 PMEdit this pageReport an issue with this page