Change8

fetch-router@0.7.0

Breaking Changes
📦 remix
4 breaking6 features🐛 1 fixes🔧 12 symbols

Summary

This release introduces breaking changes to package dependencies and response helper exports, while adding support for nested route maps and improved request abort handling.

⚠️ Breaking Changes

  • Moved @remix-run/form-data-parser, @remix-run/headers, and @remix-run/route-pattern to peerDependencies. Ensure these are installed in your project.
  • Renamed InferRouteHandler to BuildRouteHandler and added a Method generic parameter.
  • Removed support for passing a Route object to redirect(). Use redirect(routes.home.href()) instead.
  • Moved html(), json(), and redirect() response helpers to the @remix-run/fetch-router/response-helpers export path.

Migration Steps

  1. Install @remix-run/form-data-parser, @remix-run/headers, and @remix-run/route-pattern as direct dependencies if not already present.
  2. Update code referencing InferRouteHandler to use BuildRouteHandler.
  3. Update redirect(routeObject) calls to redirect(routeObject.href()).
  4. Update import statements for html, json, and redirect to import from '@remix-run/fetch-router/response-helpers'.

✨ New Features

  • Global middleware now runs even when no route matches.
  • Improved type inference for router.get(), router.post(), and other route handlers.
  • Added support for nesting route maps via object spread syntax.
  • Added support for URL objects in the redirect() response helper.
  • Added support for request.signal abort; router.fetch() now throws a DOMException (AbortError) when aborted.
  • Provided empty context.formData to mutation handlers (POST/PUT/etc) when parseFormData is false.

🐛 Bug Fixes

  • Fixed non-spec-compliant behavior in Router.fetch.

🔧 Affected Symbols

@remix-run/form-data-parser@remix-run/headers@remix-run/route-patternInferRouteHandlerBuildRouteHandlerredirecthtmljsonrouter.getrouter.postrouter.fetchcontext.formData