Lifecycle & Actions

affects

Marks a reactive source or store location as pending while work that will change it is in flight. Marked values remain readable, and derived readers report the pending state until the surrounding action or update settles.


Import

import { affects } from "solid-js";

Type signature

function affects(target: Accessor<unknown> | Store<object>): void;
function affects<T extends object>(target: Store<T>, key: keyof T): void;

Parameters

target

  • Type: Accessor<unknown> | Store<object> | Store<T>

An accessor, a store, or a store node to mark as pending.

key

  • Type: keyof T

When target is a store, the property to mark instead of the whole store.


Examples

const reload = action(function* () {
affects(thing); // `thing` and its derivations pend…
refresh(thing); // …over this otherwise-quiet re-ask
yield api.done();
});

Caveats

  • Marking does not change the value or trigger a refetch; it only reports pending. Pair with refresh() to re-ask.

Common problems


Learn more

Last updated: 10/15/26, 9:29 AMEdit this pageReport an issue with this page