Skip to content

Commit b2814ce

Browse files
committed
Apply review suggestions
1 parent 4db35b6 commit b2814ce

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

docs_headless/astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export default defineConfig({
171171
items: [
172172
'inputs',
173173
'useinput',
174+
'useChoicesContext',
174175
'referenceinputbase',
175176
'referencearrayinputbase',
176177
],

docs_headless/src/content/docs/ReferenceArrayInputBase.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const PostEdit = () => (
3939
);
4040

4141
const TagSelector = () => {
42-
const { choices, isLoading, error, source } = useChoicesContext();
42+
const { allChoices, isLoading, error, source } = useChoicesContext();
4343
const { field, id } = useInput({ source });
4444

4545
if (isLoading) return <div>Loading...</div>;
@@ -56,7 +56,7 @@ const TagSelector = () => {
5656
return (
5757
<fieldset>
5858
<legend>Select tags</legend>
59-
{choices.map(choice => (
59+
{allChoices.map(choice => (
6060
<label key={choice.id} style={{ display: 'block' }}>
6161
<input
6262
type="checkbox"
@@ -125,7 +125,7 @@ You can access the choices context using the `useChoicesContext` hook.
125125
import { ReferenceArrayInputBase, useChoicesContext, useInput } from 'ra-core';
126126

127127
export const CustomArraySelector = () => {
128-
const { choices, isLoading, error, source } = useChoicesContext();
128+
const { allChoices, isLoading, error, source } = useChoicesContext();
129129
const { field, id } = useInput({ source });
130130

131131
if (isLoading) {
@@ -147,7 +147,7 @@ export const CustomArraySelector = () => {
147147
return (
148148
<fieldset>
149149
<legend>Select multiple tags</legend>
150-
{choices.map(choice => (
150+
{allChoices.map(choice => (
151151
<label key={choice.id} style={{ display: 'block' }}>
152152
<input
153153
type="checkbox"

docs_headless/src/content/docs/useChoicesContext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "useChoicesContext"
33
---
44

5-
The [`<ReferenceInputBase>`](./referenceinputbase) and [`<ReferenceArrayInputBase>`](./referencearrayinputbase) components create a `ChoicesContext` to store the choices, as well as filters, pagination, sort state, and callbacks to update them.
5+
The [`<ReferenceInputBase>`](./ReferenceInputBase.md) and [`<ReferenceArrayInputBase>`](./ReferenceArrayInputBase.md) components create a `ChoicesContext` to store the choices, as well as filters, pagination, sort state, and callbacks to update them.
66

77
The `ChoicesContext` is very similar to the [`ListContext`](./uselistcontext) with the exception that it does not return a `data` property but 3 choices related properties:
88

0 commit comments

Comments
 (0)