Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayInput doesn't work in Filter #9488

Closed
dmyarot opened this issue Dec 1, 2023 · 4 comments · Fixed by #9521
Closed

ArrayInput doesn't work in Filter #9488

dmyarot opened this issue Dec 1, 2023 · 4 comments · Fixed by #9521
Labels

Comments

@dmyarot
Copy link

dmyarot commented Dec 1, 2023

What you were expecting:
Based on documentation trying to use ArrayInput in Filter

What happened instead:
Got message "Something went wrong"

Cannot read properties of undefined (reading 'registerField')
    at ArrayInput (http://localhost:8080/node_modules/.vite/deps/chunk-UEHWZ4FH.js?v=4d2fd337:5417:25)
    at div
    at http://localhost:8080/node_modules/.vite/deps/chunk-7Y6RS6IL.js?v=4d2fd337:1447:50
    at FilterFormInput (http://localhost:8080/node_modules/.vite/deps/chunk-UEHWZ4FH.js?v=4d2fd337:8243:29)
    at form
    at http://localhost:8080/node_modules/.vite/deps/chunk-7Y6RS6IL.js?v=4d2fd337:1447:50
    at LabelPrefixContextProvider (http://localhost:8080/node_modules/.vite/deps/chunk-5K77EFXW.js?v=4d2fd337:9426:19)
    at FilterFormBase (http://localhost:8080/node_modules/.vite/deps/chunk-UEHWZ4FH.js?v=4d2fd337:8483:25)
    at FormProvider (http://localhost:8080/node_modules/.vite/deps/chunk-HR3Q2M2G.js?v=4d2fd337:80:11)
    at FilterForm (http://localhost:8080/node_modules/.vite/deps/chunk-UEHWZ4FH.js?v=4d2fd337:8429:29)
    at Filter (http://localhost:8080/node_modules/.vite/deps/chunk-UEHWZ4FH.js?v=4d2fd337:8963:24)

Related code:

<Filter {...props}>
    <ArrayInput label='Array' source='item_not_in'>
        <SimpleFormIterator>
            <NumberInput source='item' />
        </SimpleFormIterator>
    </ArrayInput>
</Filter>

Other information:
This problem was solved in previous version (3) but It seems now broken again.
#4095

Environment

  • React-admin version: 4.14.5
  • React version: 18.2.0
@djhi
Copy link
Collaborator

djhi commented Dec 4, 2023

Thanks for reporting this. Please provide a sample application showing the issue by forking the following Stackblitz (https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/simple).

@dmyarot
Copy link
Author

dmyarot commented Dec 8, 2023

Thanks for your response! I added an ArrayInput to postFilter and the error is reproduced:
https://stackblitz.com/edit/github-zhonyr?file=src%2Fposts%2FPostList.tsx

@fzaninotto
Copy link
Member

Reproduced, thanks!

@dmyarot
Copy link
Author

dmyarot commented Dec 13, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants