reconcile
Returns a draft-mutating function that smart-merges value into a store,
preserving the identity of items whose key field matches between old and
new states. Useful when applying server payloads or full-replacement data
onto an existing store without losing fine-grained reactivity.
Items with the same key are updated in place (only changed properties trigger updates). Items added or removed update the corresponding signals.
Import
import { reconcile } from "solid-js";Type signature
function reconcile<T extends U, U>( value: T, key: string | ((item: NonNullable<any>) => any));Parameters
value
The next state to merge in
key
Property name (string) or extractor function for stable identity
Examples
const [todos, setTodos] = createStore<Todo[]>([]);
async function refresh() { const fresh = await api.getTodos(); setTodos(reconcile(fresh, "id")); // diff-merge by `id`}