Advanced / Interop & Async

resolve

Awaits a reactive expression and returns its first fully-settled value as a Promise. Pending async reads (createMemo returning a promise, etc.) are waited on; once the expression returns synchronously without NotReadyError the promise resolves with that value.

Must be called outside a tracking scope — it doesn't subscribe, it just resolves the current value once.


Import

import { resolve } from "solid-js";

Type signature

function resolve<T>(fn: () => T): Promise<T>;

Parameters

fn

A reactive expression to resolve


Examples

const user = createMemo(() => fetch(`/users/${id()}`).then((r) => r.json()));
// outside any reactive scope
const initial = await resolve(() => user());
Last updated: 7/4/26, 6:21 PMEdit this pageReport an issue with this page