react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

Documentation update in sample.

Open JustinHarshbarger opened this issue 1 year ago • 3 comments

What you were expecting: After updating my version of react-admin (granted I was a bit behind) I started getting errors with editing resources. It appears that at some point there was a change where disabled inputs not longer are sent with the update request record.

What happened instead: Was sending undefined where it previously sent the disabled id value.

Other information: I was able to get around this by removing disabled and setting as read only. This is definitely not a high priority ticket, but I figured I'd put in this suggestion.

I think the latest documentation here should be updated to show disabled instead and/or have some sort of note on the disabled prop that it will not be sent with the request.

Environment

  • React-admin version: 4.16.12
  • Last version that did not exhibit the issue (if applicable):
  • React version: 18.2.0
  • Browser: Chrome v122.0.6261.94

JustinHarshbarger avatar Mar 14 '24 17:03 JustinHarshbarger

Thanks for your report.

This is a known react-hook-form regression, already discussed in another issue. The solution is to use readOnly instead of disabled (see the doc: https://marmelab.com/react-admin/Inputs.html#disabled).

Closing this issue as duplicate.

fzaninotto avatar Mar 14 '24 18:03 fzaninotto

Oh, I did miss the update details below. However, the sample in the usage section is still using disabled on an Edit which will cause problems referencing the record if someone starts with a copy paste from there. Thanks for the quick response.

JustinHarshbarger avatar Mar 14 '24 18:03 JustinHarshbarger

You're right! I'm reopening this issue and marking it as a documentation problem.

fzaninotto avatar Mar 14 '24 18:03 fzaninotto