> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://ensforge.com/api/mcp` to find what you need.

# Upgrade to 0.1.1

Version 0.1.1 changes the React hook options, result fields, and cache helper names.
This guide applies to applications using `@ensforge/react` 0.1.0. Core and SDK callers do not need
these React-specific changes.

## Replaced `query` options with `atom`

Move `enabled` and value mapping to the top level. Put cache and retry behavior under `atom`:

:::code-group
```tsx [Before]
const owner = useOwner({
  name: "example.eth",
  query: {
    enabled: true,
    select: (result) => result.owner,
    staleTime: 30_000,
    gcTime: 300_000,
  },
});
```

```tsx [After]
const owner = useOwner({
  name: "example.eth",
  enabled: true,
  map: (result) => result.owner,
  atom: {
    idleTTL: "5 minutes",
    swr: { staleTime: "30 seconds" },
  },
});
```
:::

| Previous option              | Replacement                                        |
| ---------------------------- | -------------------------------------------------- |
| `query.enabled`              | `enabled`                                          |
| `query.select`               | `map`                                              |
| `query.gcTime`               | `atom.idleTTL`                                     |
| `query.refetchInterval`      | `atom.refreshInterval`                             |
| `query.staleTime`            | `atom.swr.staleTime`                               |
| `query.refetchOnWindowFocus` | `atom.swr.revalidateOnFocus`                       |
| Numeric `retry`              | An Effect `Schedule`, such as `Schedule.recurs(2)` |
| Provider `defaults.queries`  | `defaults.atoms`                                   |

See [Atom options](/react/api/atom-options) for defaults and Suspense differences.

## Renamed result fields

| Previous field                          | Replacement               |
| --------------------------------------- | ------------------------- |
| `isError`                               | `isFailure`               |
| Read `isPending`, mutation `isIdle`     | `isInitial`               |
| Read `isFetching`, mutation `isPending` | `isWaiting`               |
| Read `isLoading`                        | `isInitial && isWaiting`  |
| Read `isRefetching`                     | `!isInitial && isWaiting` |
| `refetch()`                             | `refresh()`               |
| `refetchEffect()`                       | `refreshEffect()`         |

The `status` and `fetchStatus` strings are removed. Use these flags or the native `result`
(`AsyncResult`) instead. `data`, `error`, `cause`, and `isSuccess` remain available.

## Replaced mutation callbacks with `onExit`

Replace `onSuccess`, `onError`, and `onSettled` with `onExit`, which receives the Effect result
and the action parameters:

```tsx
import { Exit } from "effect";
import { useSetText } from "@ensforge/react";

const setText = useSetText({
  onExit: (exit, parameters) => {
    if (Exit.isSuccess(exit)) {
      console.log("Updated record", parameters.key, exit.value);
    } else {
      console.error("Record update failed", exit.cause);
    }
  },
});
```

`mutate`, `mutateAsync`, and `mutateEffect` retain their roles. The per-call options passed to
`mutate` also use `onExit`.

## Renamed cache helpers and types

| Before                                            | After                                |
| ------------------------------------------------- | ------------------------------------ |
| `createEnsforgeRegistry`                          | `createRegistry`                     |
| `invalidateEnsforge` / `invalidateEnsforgeEffect` | `invalidate` / `invalidateEffect`    |
| `prefetchEnsforge` / `prefetchEnsforgeEffect`     | `prefetch` / `prefetchEffect`        |
| `useInvalidateEnsforge`                           | `useInvalidate`                      |
| `prefetchQueryAtom`                               | `prefetchAtom`                       |
| `EnsQueryOptions` / `EnsQueryDefaults`            | `EnsAtomOptions` / `EnsAtomDefaults` |
| `EnsQueryResult`                                  | `EnsAtomResult`                      |
| `UseEnsQueryParameters`                           | `UseEnsAtomParameters`               |
| `EnsMutationCallbacks`                            | `EnsMutationExecutionOptions`        |

Run your typecheck to find remaining old imports, then verify initial loading, background refresh,
failed reads, and mutation callbacks in your UI.
