Data fetching from Solid 1
Most of the Solid 1 migration is renaming and reshaping: split an effect, convert a store setter, replace Suspense with Loading.
Data fetching is different.
createMemo(async () => ...) looks like a shorter createResource, and for one memo on one page it is.
Across an app, though, it changes when the screen updates.
Nothing errors or warns, but the app starts waiting in places it never waited before.
This page is for teams whose Solid 1 app already fetches data in a way that works. For each common pattern, it shows how to keep it working unchanged in Solid 2, what changes when you convert it, and how to choose the behavior per fetch. For new code, the converted behavior is the better default; Async reactivity explains why. The general migration guide covers everything that is not fetching.
What changes
In Solid 1 you connected a fetch to the code that used it. An effect or a resource started the request, a signal or store received the result, and the JSX read it and checked a loading flag. Solid did not know that the request and the value were related, so each part of the page updated on its own schedule.
In Solid 2 an async memo is part of the reactive graph. Solid knows which inputs it depends on and when it is still loading. The key consequence: when you change an input of an async memo, Solid keeps the current page on screen until the new data is ready, and every other change made at the same time waits too.
A dashboard shows the difference. A period selector feeds three panels whose requests take 200 milliseconds, one second, and ten seconds:
const [period, setPeriod] = createSignal("2026-Q2");
<PeriodSelect value={period()} onChange={setPeriod} /><SummaryPanel period={period()} /> // 200 ms<TrendPanel period={period()} /> // 1 s<AuditPanel period={period()} /> // 10 sWith Solid 1 fetching, changing the period changes the selector at once, and each panel updates when its own request finishes. For ten seconds the summary shows the new period next to an audit log for the old one.
With three async memos, the change to period is held.
The selector and all three panels keep their old content, and after ten seconds everything changes together.
The page never disagrees with itself.
But the fast panels wait for the slow one, and unless something responds to the click, the page looks frozen for ten seconds.
Neither is right for every screen. Totals that must add up, a detail page, and a form should change together. Independent widgets should not have to. Solid 2 supports both, but the default changed, and a migrated app gets the new default everywhere at once. The rest of this page helps you choose, one fetch at a time.
Migrate in this order
- Make the app run on Solid 2 without changing how it fetches.
Split effects into compute and effect phases, fix reads that expect to see a write immediately, and replace
onMountandSuspense. Your fetching code keeps its shape and its timing. Test here; this is your baseline. - Convert one fetch at a time to an async computation. For each one, decide what the user should see while it refetches, using the table below. Start with fetches that stand alone on a page, where nothing visible changes.
- Delete what Solid now does for you. Loading flags, cancellation of superseded requests, and stale-result guards go away as each fetch converts.
Do not convert every fetch in one commit. The waiting behavior starts when the last fetch in a chain converts, which can be far from the code you are editing.
Pattern: an effect, a store, and a loading flag
This shape is common in Solid 1 applications that never adopted Suspense:
// Solid 1function TabPanel() { const [global] = useGlobalStore(); const [tabData, setTabData] = createStore<TabData>({ rows: [] }); const [isLoading, setIsLoading] = createSignal(true);
const fetchTabData = async () => { setIsLoading(true); const response = await TabAPI.get(global.period, global.department.id); if (response.success) setTabData(response.result); setIsLoading(false); };
onMount(fetchTabData); createEffect( on( [() => global.period, () => global.department.id, reloadSignal], fetchTabData, { defer: true, } ) );
return ( <Show when={!isLoading()} fallback={<LoadingIndicator />}> <TabRows rows={tabData.rows} /> </Show> );}Step 1: keep it working
Solid 2 effects have two phases.
The compute phase tracks reads and returns a value.
The effect phase receives that value, is not tracked, does the work, and can return a cleanup.
Effects run once on creation, so the onMount call folds into the effect:
// Solid 2, same behaviorfunction TabPanel() { const [global] = useGlobalStore(); const [tabData, setTabData] = createStore<TabData>({ rows: [] }); const [isLoading, setIsLoading] = createSignal(true);
createEffect( () => [global.period, global.department.id, reloadSignal()] as const, ([period, departmentId]) => { const controller = new AbortController(); setIsLoading(true); TabAPI.get(period, departmentId, controller.signal).then((response) => { if (controller.signal.aborted) return; if (response.success) setTabData(reconcile(response.result)); setIsLoading(false); }); return () => controller.abort(); } );
return ( <Show when={!isLoading()} fallback={<LoadingIndicator />}> <TabRows rows={tabData.rows} /> </Show> );}This works and produces no warnings.
Writing to a signal or store from the effect phase is allowed; the createEffect reference uses a fetch with an abort cleanup as its own example.
Solid does not know that tabData comes from a request, so nothing waits: the period changes at once, the panel shows its indicator, and the rows update when the response arrives.
This is Solid 1 behavior on Solid 2.
Treat it as a first step.
Because Solid cannot see this fetch, isPending, refresh, Errored, and server streaming do not work with it, and you still maintain the loading flag, the cancellation, and the stale-response check.
Avoid unnecessary effects recommends against this pattern in new code.
For an app that already has fifty of them, it is a safe first commit.
Step 2: convert it, and choose the refetch behavior
The async version removes the flag, the cancellation, and the stale-response check:
function TabPanel() { const [global] = useGlobalStore(); const [tabData] = createStore<TabData>( async () => { const response = await TabAPI.get(global.period, global.department.id); if (!response.success) throw new Error(response.error); return response.result; }, { rows: [] } );
return ( <Loading fallback={<LoadingIndicator />}> <TabRows rows={tabData.rows} /> </Loading> );}createStore(async fn, seed) reads the inputs, awaits the response, and reconciles the result into the store, so TabRows re-renders only the rows that changed.
Solid ignores the result of an outdated run; the AbortController was doing that by hand.
A failed response throws, so the nearest Errored boundary can show it and retry it.
reloadSignal() becomes refresh(tabData).
Now the behavior change from the first section applies.
The first load still shows LoadingIndicator.
When global.period changes, the indicator does not come back: the old rows stay on screen until the new rows arrive.
If other panels read the same period, they all update together, and the selector waits with them.
Decide what this panel should do while it reloads:
-
Keep the old rows and dim them while the new ones load. This is the default. Add an indicator so the wait is visible:
<Loading fallback={<LoadingIndicator />}><div class={{ refreshing: isPending(() => tabData.rows) }}><TabRows rows={tabData.rows} /></div></Loading> -
Show the indicator again, as the Solid 1 version did, when the subject of the panel changed. Name that subject in the boundary's
onprop:<Loadingon={[global.period, global.department.id]}fallback={<LoadingIndicator />}><TabRows rows={tabData.rows} /></Loading>When the period or department changes, this boundary shows its fallback, and the rest of the page no longer waits for this panel. Other panels that read the same period without
onstill make the page wait, so giveonto each panel that should update on its own.
The literal translation of the Solid 1 <Show when={!isLoading()}> is <Show when={!isPending(() => tabData.rows)} fallback={<LoadingIndicator />}> inside the Loading boundary.
It works: while the reload is pending, the content unmounts, and the page no longer waits for the panel.
Prefer on when the panel should reset because its subject changed, because on keeps the content during a reload of the same subject, such as a refresh.
Pattern: createResource with Suspense
// Solid 1const [user] = createResource(() => params.id, fetchUser);
<Suspense fallback={<UserSkeleton />}> <UserProfile user={user()} /></Suspense>;Convert the resource to an async memo and the boundary to Loading:
// Solid 2const user = createMemo(() => fetchUser(params.id));
<Loading fallback={<UserSkeleton />}> <UserProfile user={user()} /></Loading>;user() is typed User, not User | undefined, and the boundary handles the first load as Suspense did.
The difference is in the reload.
In Solid 1, changing params.id refetched the resource and, unless the change happened inside startTransition, the boundary showed its fallback again.
Teams worked around this with user.latest or by wrapping navigation in a transition.
In Solid 2 that is the default: the old user stays on screen, and the new user replaces it when ready.
resource.latest has no replacement because a plain read now does the same thing.
Most resource-and-Suspense code needs no more than the rename.
Where the Solid 1 fallback-on-refetch was the intended design, such as a profile page that should not show one user's name over another's data, use on:
<Loading on={params.id} fallback={<UserSkeleton />}> <UserProfile user={user()} /></Loading>Where you used startTransition to keep the old content during a reload, delete it; that is now the default, and isPending replaces the useTransition pending flag.
The resource's other members map as follows:
| Solid 1 | Solid 2 |
|---|---|
user.loading on first load | Loading boundary |
user.loading on refetch | isPending(user) |
user.error | Errored boundary |
refetch() | refresh(user); add affects(user) first when the reload should show as pending |
mutate(value) | An action with createOptimistic |
user.latest | A plain read |
Pattern: createResource with .loading and no Suspense
// Solid 1const [orders] = createResource(() => filters(), fetchOrders);
<Show when={!orders.loading} fallback={<Spinner />}> <OrderTable orders={orders()!} /></Show>;This is the resource used as a value with a flag, and it behaves like the effect pattern: a spinner on first load and on every refetch, each table on its own schedule.
The conversion is the same as above, and the same choice applies:
// Solid 2const orders = createMemo(() => fetchOrders(filters()));
<Loading on={filters()} fallback={<Spinner />}> <OrderTable orders={orders()} /></Loading>;With on, changing the filters shows the spinner and the rest of the page does not wait, as in Solid 1.
Without on, the old table stays until the new orders arrive; add isPending(orders) to show that it is loading.
If the first-load branch must live in your own JSX rather than a boundary, for example because the spinner is part of the table's own layout, declare a placeholder with loadingValue:
const orders = createMemo<Order[] | undefined>(() => fetchOrders(filters()), { loadingValue: undefined,});
<Show when={orders()} fallback={<Spinner />}> {(loaded) => <OrderTable orders={loaded()} />}</Show>;The placeholder is used until the first result arrives, so no Loading fallback shows and the Show decides what renders.
Reloads still behave as above.
Use this only when a boundary does not fit; a boundary is the clearer way to handle a first load.
Pattern: Solid Router createAsync and cache
Router data loading in Solid 1 was built on resources, so createAsync with Suspense migrates like the resource pattern, including the change to reload behavior.
Replace createAsync(() => getUser(params.id)) with createMemo(() => getUser(params.id)) and cache with query.
Route navigations already ran inside a transition in Solid 1, so a route that kept its content during navigation still does.
The Solid Router migration guide covers the API changes, and Data loading and mutations covers query, preload, and revalidation in Solid 2.
Decide per fetch
Ask: while this data reloads, what should the user see?
| The user should see… | Use |
|---|---|
| Nothing change until everything that depends on the input is ready | The default; add isPending so the wait is visible. |
| The control they touched reflect their input now, and the content wait | latest on the control, isPending to dim the content. |
| A placeholder in place of the content for the changed subject | <Loading on={key}> around that content. |
The first two rows usually go together: the tab highlights at once, and the content dims until the new content is ready. Async reactivity shows each piece.
A useful test for a widget: if it showed last period's numbers for five seconds with a spinner on it, is that fine or wrong?
If that is fine, the widget is independent, and either on or dimmed old content works.
If it is wrong, the widget is part of a view that must stay consistent, and the default is doing its job.
What you get when you stop
Each fetch that converts removes code you were maintaining:
- The loading flag and the code that sets it in the right order.
- The
AbortControlleror "is this response still current" check; Solid ignores outdated results. - The
successcheck that turned an error into a silent empty state; a thrown error reachesErroredand can be retried. - The reload signal;
refresh(source)loads the data again.
You also get things you could not get before: panels that appear together, isPending in any component without passing a flag through props, and server rendering that streams each region as its data loads.
Convert the standalone fetches first, the independent panels with on second, and the views that must stay consistent last.
Checklist
- The app runs on Solid 2 with its Solid 1 fetching shape and passes its tests.
- Each fetch has a decision: keep old content, keep it with
lateston the control, oron. - Every
onprop receives a value such asparams.id, not an accessor. -
isPendingshows a response wherever a click would otherwise seem to do nothing. - Loading flags, abort controllers, and stale-response checks are gone from converted fetches.
- Reload signals are
refresh(source)calls, withaffectswhere the reload should show as pending. - Failed requests throw and an
Erroredboundary covers them.