react-jsonschema-form-pagination icon indicating copy to clipboard operation
react-jsonschema-form-pagination copied to clipboard

shouldComponentUpdate() is too conservative

Open FranciscoPinto opened this issue 6 years ago • 0 comments

Hello,

First of all, thank you very much for the nice package, which has already saved us a considerable amount of time.

Currently, shouldComponentUpdate() seems to return true only when the navs change. This messes with my workflow in multiple ways:

  • I want to disable the form as it is being submitted;
  • My form has children (a custom button which animates while the form is being submitted, a "Saved!" message when the data the form is currently displaying is stored server-side, etc.).

To experiment, I overrode shouldComponentUpdate() and made it always return true. However, this made my form's fields lose focus on change arbitrarily. This leads me to believe the author is using shouldComponentUpdate() to prevent this buggy behaviour as opposed to solely as a performance optimization.

Here's an SSCCE: https://codesandbox.io/s/q8o8mmlyoj

Thanks for any help you may be able to provide. I might start work on a PR in parallel.

FranciscoPinto avatar Feb 12 '19 21:02 FranciscoPinto