Skip to content

Fix isSubmitting formState when encType is application/json for Remix.run#169

Merged
AlemTuzlak merged 2 commits intocode-forge-io:remix_branchfrom
CommerceBear:bugfix/remix_branch/fix-json-issubmitting
Jun 20, 2025
Merged

Fix isSubmitting formState when encType is application/json for Remix.run#169
AlemTuzlak merged 2 commits intocode-forge-io:remix_branchfrom
CommerceBear:bugfix/remix_branch/fix-json-issubmitting

Conversation

@BobReid
Copy link
Copy Markdown
Contributor

@BobReid BobReid commented May 27, 2025

Description

This PR fixes a bug where the form isSubmitting state is not tracked properly when using encType: 'application/json'.
The issue is that the hook only considers navigation / fetcher formData when calculating that a submission is happening. formData is always undefined when using application/json and navigation / fetcher json is populated with the equivalent data.

Fixes #168

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

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

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

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

@AlemTuzlak
Copy link
Copy Markdown
Contributor

Awesome work, Thank you, i'll test this out just to confirm and release it asap, would you also consider porting it to the latest release?

@BobReid
Copy link
Copy Markdown
Contributor Author

BobReid commented May 27, 2025

@AlemTuzlak Yea id be happy to port it to the latest release if you are good with the change

@BobReid BobReid changed the title Implement support for application/json for Remix.run Fix isSubmitting formState when encType is application/json for Remix.run May 27, 2025
@BobReid
Copy link
Copy Markdown
Contributor Author

BobReid commented May 29, 2025

@AlemTuzlak I noticed that this branch is only compatible with react-hook-form <= 7.54.x but the peer dependency is specified as ^7.55.0.

If you install the correct react-hook-form branch then everything works but a straight up npm install from a fresh state the RemixFormProvider will be broken due to the incompatible version.

Should I update the peer dependency specifier to specify the compatible versions or should I backport the fixes.
It has to do with an extra property introduced by the react-form-hook useForm hook return value that needs to be passed into the FormProvider.

@AlemTuzlak AlemTuzlak merged commit 379470c into code-forge-io:remix_branch Jun 20, 2025
@AlemTuzlak
Copy link
Copy Markdown
Contributor

@BobReid that would be great, I just merged this PR so we can release it, feel free to open up a new one for the backport!

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