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

[INV-3687] PMP Validation #3705

Merged
merged 4 commits into from
Nov 22, 2024
Merged

[INV-3687] PMP Validation #3705

merged 4 commits into from
Nov 22, 2024

Conversation

LocalNewsTV
Copy link
Collaborator

@LocalNewsTV LocalNewsTV commented Nov 21, 2024

Overview

This PR includes the following proposed change(s):

Important

This fix is symptomatic of a larger issue with re-rendering not working properly for props.rawErrorsin the custom validation.
When the rawErrors array is updated, the FieldTemplates are not re-rendering as expected. However, since most errors are self-contained, the change events trigger a re-render of the component, which resolves the issue. This behavior doesn't apply to the PMP not in dropdown and Pest Management Plans inputs, as these are independent from each other but share a custom validation rule. So when the error is removed, a re-render is not created.

Smaller Fixes

  • Fixed issue in SingleSelectAutoComplete, where non-responses need to be undefined and not null. this triggers must be a string errors when user deletes an input
  • Reduce customErrorTransformer to be more DRY and readable

FormContainer.tsx

  • Flip padding to x instead of explicit left/right
  • manually call validateForm() in the useEffect when we are doing a Chemical Treatment form
    • The useEffect is fired by the debounced function, so this won't produce n validation checks where n is keystrokes
    • When we use liveValidate(), nothing gets logged because its an implicit action. Opposite of this, when we explicitly perform validateForm() Rjsf fires a console.error containing the validation errors
      • We can override handling of validateForm() by adding the onError prop to <Form>, eliminating the logs.

Closes #3687
Ticket #3706 created to address the overarching Render concerns

@plasticviking plasticviking merged commit 6c56928 into dev Nov 22, 2024
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chemical treatment PMP validation bugging out
2 participants