---
title: "Trash hooks"
description: "Hand-written shim. CRUD methods are generated; see ./trash.gen.

Adds a hand-written `useEmptyTrash` because the trash.empty op is
a bulk operation that doesn't fit the generated mutation shape —
we want it to invalidate everything (the trash list AND every
touched entity's own cache, which we can't enumerate ahead of
time, so we settle for invalidating `trashKeys.all()` plus
letting consumers attach extra invalidations via options)."
section: "Libraries"
group: "React hooks"
order: 461
---

## Hooks

### `useEmptyTrash` `composite`

Empty trash — purges every soft-deleted entity in scope.

```ts
useEmptyTrash(options?: MutationOpts<EmptyTrashResult, EmptyTrashParams | undefined>)
```

**Types:** [EmptyTrashResult](/types/empty-trash-result) · [EmptyTrashParams](/types/empty-trash-params)

### `useListTrash` `query`

List soft-deleted entities across the caller's workspaces.

```ts
useListTrash(params?: ListTrashParams, options?: QueryOpts<Page<TrashItem>>)
```

**Types:** [ListTrashParams](/types/list-trash-params) · [Page](/types/page) · [TrashItem](/types/trash-item)
