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

fix useActionData re-render issue, refactored mergeErrors & standardize errors to react-hook-form #35

Closed
wants to merge 4 commits into from

Conversation

Centerworx
Copy link

Description

Note: This should go in after: #33

or merge this and skip the other.

**Test Case: **

  • updated and all current test pass
  • add some new test for new behavior
  • ported into my project for manual testing
  1. remix will send back errors on every re-render by default which means in order for react hook form to work as intended you will have to call your api on every state change. By adding the "shouldResetActionData" prop we allow user to pick to use react-hook-form behavior or remix form behavior.

  2. standardize the errors returned by mergeErrors to match to react-hook-form error, this includes a type: "backend" to allow devs to know where the error came from.

Fixes # (issue)
Fixes issue #1 above, the useActionData issue were backend error are overriding resolved errors from the frontend, persisting the backend error after they are resolved or cleared with clearErrors().

If this is a new feature please add a description of what was added and why below:

see above

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (This requires all error to be under the server errors response object, to conform to web standards)
  • This change requires a documentation update - See readMe

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit tests - And I've been using it for months in my own repo.

Checklist:

  • My code follows the guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

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.

2 participants