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

Form-related fixes, improvements and refactoring #4283

Merged

Conversation

DingDongSoLong4
Copy link
Collaborator

This started out as a fix for #4268, but I got a bit carried away...

  • Fixed another validateDOMNesting error (<CommonLinkComponent> already adds a <Link>)
  • Fixed a forwardRef error - <ReactDatePicker> requires its customInput to be "ref-able"
  • Fixed the "encoding_image" intl message - the correct id is "actions.encoding_image"
  • RatingSystem now returns null rather than undefined when clearing the rating value - this fits better when using it as a form input, since null represents clearing a value in GraphQL whereas undefined represents not modifying the existing value.
  • Improved TextUtils.secondsToTimestamp() to properly support inputs over 24 hours and negative inputs. Since DurationUtils.secondsToString() is functionally equivalent to TextUtils.secondsToTimestamp(), I've removed the former and also moved DurationUtils.stringToSeconds() into TextUtils to be able to remove DurationUtils entirely.
  • DurationInput also now returns null for the same reasons as RatingSystem, and it can now properly handle negative inputs, due to the above improvements to TextUtils.secondsToTimestamp().
  • A minor change to DateInput, to no longer accept undefined as a value. The DateInput component is basically just a thin wrapper around an <input>, which should not have its value set to undefined unless it is uncontrolled.
  • Removed a whole bunch of unused render functions in src/utils.
  • The biggest change, refactored the rendering of the various edit forms. This means that all normal <input>-based components now have error messages displayed, and alignment and styling is more consistent across the different forms. The forms are also now much easier to use when on mobile: the inputs now always wrap so that the label is above the input on small screens, which allows the input to be wider.
  • And then the actual fix for [Bug Report] performer height In centimeters with decimals causes Error Response not successful: Received status code 422 #4268 - fractional values are now truncated to integers when submitting the form. I've also done some refactoring in the yup schemas, and added utility functions for dealing with enums and numbers in forms.

Fixes #4268

@WithoutPants WithoutPants added bug Something isn't working improvement Something needed tweaking. labels Nov 20, 2023
@WithoutPants WithoutPants merged commit 959f253 into stashapp:develop Nov 20, 2023
2 checks passed
@DingDongSoLong4 DingDongSoLong4 deleted the formik-yup-improvements branch November 20, 2023 10:09
halkeye pushed a commit to halkeye/stash that referenced this pull request Sep 1, 2024
* Fix another validateDOMNesting error
* Fix React.forwardRef error
* Fix encoding_image intl message
* Return null instead of undefined from RatingSystem
* DurationInput tweaks
* DateInput tweaks, remove unused utils functions
* Refactor and deduplicate edit form rendering
* Improve/fix yup validation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement Something needed tweaking.
Projects
None yet
2 participants