useClearIndexedDbPersistenceMutation
A mutation which wraps the clearIndexedDbPersistence function.
Usage
import { getFirestore } from 'firebase/firestore';
import { clearIndexedDbPersistence } from '@tanstack-query-firebase/react/firestore';
// Get a Firestore instance using the initialized Firebase app instance
const firestore = getFirestore(app);
function Component() {
  const mutation = useClearIndexedDbPersistenceMutation(firestore);
  return (
    <button disabled={mutation.isPending} onClick={() => mutation.mutate()}>
      Clear IndexedDB Persistence
    </button>
  );
}
Mutation Options
The hook also accepts the useMutation
options, for example:
const mutation = useClearIndexedDbPersistenceMutation(firestore, {
  onSuccess() {
    console.log('IndexedDB persistence cleared');
  },
  onError(error) {
    console.error('Failed to clear IndexedDB persistence', error);
  },
});