# give/4.18.0/src/Admin/fields/AssociatedDonor/useDonorAsyncSelectOptions.ts

GiveWP – Donation Plugin and Fundraising Platform, version 4.18.0. 34 lines.

- Page: https://pluginprobe.com/plugins/give/4.18.0/code/src/Admin/fields/AssociatedDonor/useDonorAsyncSelectOptions.ts
- Raw: https://pluginprobe.com/plugins/give/4.18.0/raw/src/Admin/fields/AssociatedDonor/useDonorAsyncSelectOptions.ts
- Modified: 2025-10-16T14:10:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.18.0/code/src/Admin/fields/AssociatedDonor/useDonorAsyncSelectOptions.ts#L10-L20`.

```typescript
import { useAsyncSelectOptions } from '@givewp/admin/hooks/useAsyncSelectOption';
import { Donor } from '@givewp/donors/admin/components/types';
import { useEntityRecord } from '@wordpress/core-data';

/**
 *
 * Wrapper for custom hook used to fetch donors select options
 *
 * @since 4.11.0
 */
export default function useDonorAsyncSelectOptions(donorId: number, queryParams?: {}) {
    const { record } = useEntityRecord<string[]>('givewp', 'donor', donorId);

    return useAsyncSelectOptions({
        recordId: donorId || null,
        selectedOptionRecord: record,
        endpoint: '/givewp/v3/donors',
        optionFormatter: (record: Donor) => {
            return {
                value: record.id,
                label: `${record.name} (${record.email})`,
            };
        },
        queryParams: {
            sort: 'name',
            direction: 'ASC',
            includeSensitiveData: true,
            anonymousDonors: 'include',
            onlyWithDonations: false,
            ...queryParams,
        },
    });
}

```
