---
title: useOnDisconnectRemoveMutation
---
> ## Documentation Index
> Fetch the complete documentation index at: https://react-query-firebase.invertase.dev/llms.txt
> Use this file to discover all available pages before exploring further.

Queue removal of data when the client disconnects.

## Usage

```tsx
import { ref } from "firebase/database";
import { useOnDisconnectRemoveMutation } from "@tanstack-query-firebase/react/database";

const sessionRef = ref(database, `sessions/${sessionId}`);
const { mutate } = useOnDisconnectRemoveMutation(sessionRef);
mutate();
```
