M

react-router/7/errorfirst-mutation-reorder

How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

This transformation restructures action functions to perform error checking before data mutations. This change aligns with the new behavior in v7 where loaders no longer revalidate by default after an action throws or returns a Response with a 4xx/5xx status code.

Before

ts

After

ts

Ready to contribute?

Build your own codemod and share it with the community.