---
outline: deep
---

# DF0040: JSON-Render View Used After Disposal

## Message

> JSON-render view "`{id}`" was used after it was disposed.

## Cause

`view.dispose()` unregisters the view's shared state and its broadcast listeners. Calling `update` or `patchState` on a disposed handle is a lifecycle bug — the shared state it targeted no longer exists.

## Example

```ts
const view = createJsonRenderView(ctx, { id: 'metrics', spec })
view.dispose()
view.update(nextSpec) // DF0040
```

## Fix

Create a fresh view with `createJsonRenderView` instead of reusing a disposed handle. The id is free to reuse once disposed.

## Source

- [`packages/json-render/src/node/create-view.ts`](https://github.com/devframes/devframe/blob/main/packages/json-render/src/node/create-view.ts) — `update` / `patchState` throw this after `dispose()`.
