Skip to content

Commit caf4d46

Browse files
committed
Change getContextValue for setContextValue
1 parent 15f0bce commit caf4d46

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/ra-core/src/form/useInput.spec.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ const Input: FunctionComponent<
2020
const InputWithCustomOnChange: FunctionComponent<
2121
{
2222
children: (props: ReturnType<typeof useInput>) => ReactElement;
23-
} & InputProps & { getContextValue?: (value: string) => void }
24-
> = ({ children, getContextValue, ...props }) => {
23+
} & InputProps & { setContextValue?: (value: string) => void }
24+
> = ({ children, setContextValue, ...props }) => {
2525
const { getValues } = useFormContext();
2626

2727
return (
2828
<Input
2929
{...props}
3030
onChange={e => {
3131
props.onChange(e);
32-
getContextValue(getValues()[props.source]);
32+
setContextValue(getValues()[props.source]);
3333
}}
3434
>
3535
{children}
@@ -131,7 +131,7 @@ describe('useInput', () => {
131131
const handleChange = e => {
132132
targetValue = e.target.value;
133133
};
134-
const getContextValue = value => {
134+
const setContextValue = value => {
135135
contextValue = value;
136136
};
137137

@@ -142,7 +142,7 @@ describe('useInput', () => {
142142
source="title"
143143
resource="posts"
144144
onChange={handleChange}
145-
getContextValue={getContextValue}
145+
setContextValue={setContextValue}
146146
defaultValue=""
147147
>
148148
{({ id, field }) => (

0 commit comments

Comments
 (0)