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 does not like primitive values #3249

Closed
viktor-nikolaev opened this issue May 20, 2019 · 3 comments · Fixed by #4394
Closed

ArrayInput does not like primitive values #3249

viktor-nikolaev opened this issue May 20, 2019 · 3 comments · Fixed by #4394

Comments

@viktor-nikolaev
Copy link

What happened instead:

Steps to reproduce:
I have this form

<ArrayInput source='configuration.xpathexpressions' label='XPath expressions'>
  <SimpleFormIterator>
    <TextInput label='XPath expression' />
  </SimpleFormIterator>
</ArrayInput>

Note - I don't have source prop in TextInput.
And here what I see in the browser

image

The problem is with this line:

If we make it just fields.push(); everything would work as expected, even for complex objects (ie with fields with source props)

CodeSandbox

https://codesandbox.io/s/simple-cwjuz

Here is the form with array input: https://cwjuz.codesandbox.io/#/tags/5

Other information:
A question on this topic https://stackoverflow.com/questions/51468966/react-admin-array-input-with-array-of-strings-numbers

Environment

  • React-admin version: ^2.9.1
  • Last version that did not exhibit the issue (if applicable):
  • React version: ^16.8.6
viktor-nikolaev added a commit to viktor-nikolaev/react-admin that referenced this issue May 20, 2019
@viktor-nikolaev
Copy link
Author

viktor-nikolaev commented May 20, 2019

Created PR #3250

@mleczakm
Copy link

Are there any easy way to override this method ( _this.addField in SimpleFormIterator) in current implementation?

@taitems
Copy link

taitems commented Jan 2, 2020

I'm hitting this issue now. Is there any interest in firing up the PR again, or a suitable workaround? I just want to have an array of URLs.

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

Successfully merging a pull request may close this issue.

4 participants