-
Notifications
You must be signed in to change notification settings - Fork 25
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
v3 #255
Merged
Merged
v3 #255
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update some packages
Upgrade to latest Remix
Fix TSC
React router 7
Remove deprecated parseActionData prop from <RemixForm />
Update copy
Use gray bg on html
Rename howYouFoundAboutUs to howDidYouFindUs
Fix mobile sidebar and switch from Headless UI to Radix UI
Fix conf Previous and Next navigation
Upgrade RR to latest patch
Fix CommonJS entry point
Actually call transformResult 😅
Return full result on formAction with 422 status for failure
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
v3.0.0
Breaking changes
1. Only React Router v7 is supported
Remix Forms v3 removed support for Remix and React Router v6. Before upgrading Remix Forms, please upgrade your app to React Router v7.
The Remix team made upgrading easy, so you probably should. If you can't upgrade, Remix Forms
2.3.0
is stable and will continue working with React Router v6 and Remix.2. createForm replaced by SchemaForm
Instead of using
createForm
, you can now importSchemaForm
directly fromremix-forms
.Before:
After:
We stopped using the name
Form
for our form component to avoid ambiguity with React Router'sForm
component. We now refer to our forms as "schema forms".3. createFormAction replaced by formAction
Instead of using
createFormAction
, you can now importformAction
directly fromremix-forms
.Before:
After:
4. domain-functions replaced by composable-functions
We now depend on Composable Functions for our mutations. If you are a heavy Domain Functions user, please follow our complete migration guide. For most Remix Forms users, only a few simple changes are needed.
makeDomainFunction becomes applySchema
If you already have mutations created with
makeDomainFunction
ormdf
, useapplySchema
instead.Before:
After:
environment becomes context
Composable Functions renamed
environment
to context.Before:
After:
Global errors with Error
Composable Functions requires us to throw an instance of Error for generating global errors. We cannot throw literal strings anymore.
Before:
After:
The second param to InputError is now an array
We now need to pass the field name as an array when throwing field errors.
Before:
After:
5. PerformMutation type renamed to MutationResult
If you are using the
PerformMutation
type, you'll need to change toMutationResult
from now on. The type is the same, only the name has changed.6. formAction always returns the mutation result
Now we always return the full
MutationResult
onformAction
. If you useformAction
without asuccessPath
and manually get the action data in your components, you'll have to check forsuccess
first and only then access the mutation result insidedata
:7. formAction returns 422 status on failed mutations
To avoid revalidating loaders unnecessarily,
formAction
now returns a 422 status on failed mutations.8. Removed beforeAction and beforeSuccess callbacks
We removed the
beforeAction
andbeforeSuccess
callbacks fromformAction
in favor oftransformedResult
, described below.9. Removed Callback type
Because we don't have callbacks anymore, we removed the
Callback
type that was previously exported.10. Removed deprecated parseActionData
We removed
parseActionData
from our schema form component, which was marked as deprecated since v2.11. onTransition renamed to onNavigation
SchemaForm
proponTransition
was renamed toonNavigation
to keep up with React Router's new terminology.Minor changes
12. Added transformResult
Instead of relying on callbacks, we now offer a more flexible
transformResult
option toperformMutation
andformAction
. It is a function that receives aMutationResult
and returns another result. Here's the type definition:A common use case is to make conditional redirects with custom headers, like:
The above example will
throw
a redirect in case of failures and return the result otherwise.13. successPath now accepts async functions
You can now pass an async function to
successPath
onformAction
, like: