chore: Update version for release#13175
Merged
Merged
Conversation
wilcoxmd
added a commit
to wilcoxmd/react-router
that referenced
this pull request
Mar 18, 2025
…d-route-typegen * upstream/dev: (55 commits) Fix root loader data on initial load redirects in SPA mode (remix-run#13222) Ensure ancestor pathless/index routes are loaded via manifest requests (remix-run#13203) Fix shoulRevalidate behavior in clientLoader-only routes (remix-run#13221) Stop leaking internal MiddlewareError implementation detail (remix-run#13180) Fix validation of split route modules for root route (remix-run#13238) Fix `RequestHandler` `loadContext` type when middleware is enabled (remix-run#13204) Change middleware return type from void to undefined (remix-run#13199) update docs home page add API docs Fix error message typo Fix Windows CI (remix-run#13215) Remove Vite server hooks in child compiler plugins (remix-run#13184) Support flexible ordering of Vite plugins that override SSR environment (remix-run#13183) chore: format chore: Update version for release (remix-run#13175) Exit prerelease mode chore: Update version for release (pre) (remix-run#13174) Fix JSDoc types for context (remix-run#13170) Remove middleware depth restrictions (remix-run#13172) minor language improvements in context/middleware decision doc ...
This file contains hidden or 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
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.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to release-next, this PR will be updated.
Releases
react-router@7.3.0
Minor Changes
Add
fetcherKeyas a parameter topatchRoutesOnNavigation(#13061)fetchercalls to undiscovered routes, this mismatch will trigger a document reload of the current pathPatch Changes
Skip resource route flow in dev server in SPA mode (#13113)
Fix jsdoc types for
context(#13170)Support middleware on routes (unstable) (#12941)
Middleware is implemented behind a
future.unstable_middlewareflag. To enable, you must enable the flag and the types in yourreact-router-config.tsfile:clientMiddlewarethat we will be addressing this before a stable release.contextparameter passed to yourloader/actionfunctions - see below for more information.Once enabled, routes can define an array of middleware functions that will run sequentially before route handlers run. These functions accept the same parameters as
loader/actionplus an additionalnextparameter to run the remaining data pipeline. This allows middlewares to perform logic before and after handlers execute.Here's a simple example of a client-side logging middleware that can be placed on the root route:
Note that in the above example, the
next/middlewarefunctions don't return anything. This is by design as on the client there is no "response" to send over the network like there would be for middlewares running on the server. The data is all handled behind the scenes by the statefulrouter.For a server-side middleware, the
nextfunction will return the HTTPResponsethat React Router will be sending across the wire, thus giving you a chance to make changes as needed. You may throw a new response to short circuit and respond immediately, or you may return a new or altered response to override the default returned bynext().You can throw a
redirectfrom a middleware to short circuit any remaining processing:Note that in cases like this where you don't need to do any post-processing you don't need to call the
nextfunction or return aResponse.Here's another example of using a server middleware to detect 404s and check the CMS for a redirect:
contextparameterWhen middleware is enabled, your application will use a different type of
contextparameter in your loaders and actions to provide better type safety. Instead ofAppLoadContext,contextwill now be an instance ofContextProviderthat you can use with type-safe contexts (similar toReact.createContext):If you are using a custom server with a
getLoadContextfunction, the return value for initial context values passed from the server adapter layer is no longer an object and should now return anunstable_InitialContext(Map<RouterContext, unknown>):Fix types for loaderData and actionData that contained
Records (#13139)UNSTABLE(BREAKING):
unstable_SerializesToadded a way to register custom serialization types in Single Fetch for other library and framework authors like Apollo.It was implemented with branded type whose branded property that was made optional so that casting arbitrary values was easy:
However, this broke type inference in
loaderDataandactionDatafor anyRecordtypes as those would now (incorrectly) matchunstable_SerializesTo.This affected all users, not just those that depended on
unstable_SerializesTo.To fix this, the branded property of
unstable_SerializesTois marked as required instead of optional.For library and framework authors using
unstable_SerializesTo, you may need to addas unknowncasts before casting tounstable_SerializesTo.[REMOVE] Remove middleware depth logic and always call middlware for all matches (#13172)
Fix single fetch
_root.datarequests when abasenameis used (#12898)Add
contextsupport to client side data routers (unstable) (#12941)Your application
loaderandactionfunctions on the client will now receive acontextparameter. This is an instance ofunstable_RouterContextProviderthat you use with type-safe contexts (similar toReact.createContext) and is most useful with the correspondingmiddleware/clientMiddlewareAPI's:Similar to server-side requests, a fresh
contextwill be created per navigation (orfetchercall). If you have initial data you'd like to populate in the context for every request, you can provide anunstable_getContextfunction at the root of your app:createBrowserRouter(routes, { unstable_getContext })<HydratedRouter unstable_getContext>This function should return an value of type
unstable_InitialContextwhich is aMap<unstable_RouterContext, unknown>of context's and initial values:@react-router/architect@7.3.0
Patch Changes
react-router@7.3.0@react-router/node@7.3.0@react-router/cloudflare@7.3.0
Patch Changes
react-router@7.3.0@react-router/dev@7.3.0
Patch Changes
Fix support for custom client
build.rollupOptions.output.entryFileNames(#13098)Fix usage of
prerenderoption whenserverBundlesoption has been configured or provided by a preset, e.g.vercelPresetfrom@vercel/react-router(#13082)Fix support for custom
build.assetsDir(#13077)Remove unused dependencies (#13134)
Stub all routes except root in "SPA Mode" server builds to avoid issues when route modules or their dependencies import non-SSR-friendly modules (#13023)
Fix errors with
future.unstable_viteEnvironmentApiwhen thessrenvironment has been configured by another plugin to be a customVite.DevEnvironmentrather than the defaultVite.RunnableDevEnvironment(#13008)Remove unused Vite file system watcher (#13133)
Fix support for custom SSR build input when
serverBundlesoption has been configured (#13107)Note that for consumers using the
future.unstable_viteEnvironmentApiandserverBundlesoptions together, hyphens are no longer supported in server bundle IDs since they also need to be valid Vite environment names.Fix dev server when using HTTPS by stripping HTTP/2 pseudo headers from dev server requests (#12830)
Lazy load Cloudflare platform proxy on first dev server request when using the
cloudflareDevProxyVite plugin to avoid creating unnecessary workerd processes (#13016)When
future.unstable_viteEnvironmentApiis enabled and thessrenvironment hasoptimizeDeps.noDiscoverydisabled, defineoptimizeDeps.entriesandoptimizeDeps.include(#13007)Fix duplicated entries in typegen for layout routes and their corresponding index route (#13140)
Updated dependencies:
react-router@7.3.0@react-router/node@7.3.0@react-router/serve@7.3.0react-router-dom@7.3.0
Patch Changes
react-router@7.3.0@react-router/express@7.3.0
Patch Changes
expresspeerDependencyto include v5 (feat(express): support Express v5 #13064) (#12961)react-router@7.3.0@react-router/node@7.3.0@react-router/fs-routes@7.3.0
Patch Changes
@react-router/dev@7.3.0@react-router/node@7.3.0
Patch Changes
react-router@7.3.0@react-router/remix-routes-option-adapter@7.3.0
Patch Changes
@react-router/dev@7.3.0@react-router/serve@7.3.0
Patch Changes
react-router@7.3.0@react-router/express@7.3.0@react-router/node@7.3.0create-react-router@7.3.0