Skip to content

Commit

Permalink
Fix SimpleForm controlled story
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto committed Jan 21, 2025
1 parent 8e034d8 commit a8beb34
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/ra-ui-materialui/src/form/SimpleForm.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { NumberInput, TextInput } from '../input';
import { SimpleForm } from './SimpleForm';
import { Labeled } from '../Labeled';
import { TextField, NumberField } from '../field';
import { Query, QueryClient, QueryClientProvider } from '@tanstack/react-query';

Check warning on line 17 in packages/ra-ui-materialui/src/form/SimpleForm.stories.tsx

View workflow job for this annotation

GitHub Actions / typecheck

'Query' is defined but never used. Allowed unused vars must match /^_/u

export default { title: 'ra-ui-materialui/forms/SimpleForm' };

Expand Down Expand Up @@ -203,15 +204,16 @@ export const Controlled = () => {
return (
<TestMemoryRouter>
<ThemeProvider theme={createTheme()}>
<SimpleForm
resource="books"
onSubmit={values => setRecord(values)}
>
<TextInput source="title" />
<TextInput source="author" />
<NumberInput source="year" />
</SimpleForm>
<div>Record values: {JSON.stringify(record)}</div>
<QueryClientProvider client={new QueryClient()}>
<ResourceContextProvider value="books">
<SimpleForm onSubmit={values => setRecord(values)}>
<TextInput source="title" />
<TextInput source="author" />
<NumberInput source="year" />
</SimpleForm>
<div>Record values: {JSON.stringify(record)}</div>
</ResourceContextProvider>
</QueryClientProvider>
</ThemeProvider>
</TestMemoryRouter>
);
Expand Down

0 comments on commit a8beb34

Please sign in to comment.