fix(deps): update dependency history to version 5.x 🌟 (major) #1505
  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 contains the following updates:
4.10.1->5.3.05.3.4->7.7.15.3.4->7.7.1Release Notes
remix-run/history (history)
v5.3.0Compare Source
This release provides support for native ESM consumption of all exports.
v5.2.0Compare Source
🐛 Bug fixes
State(now set tounknownwhich will require consumer type narrowing)PartialPath(usePartial<Path>instead)PartialLocation(usePartial<Location>instead)createPathreturn value (#813)✨ Features
Full Changelog: remix-run/history@v5.1.0...v5.2.0
v5.1.0Compare Source
Because the prior 5.0.2 release removed the
Statetype parameter fromLocation, this was technically a breaking change. To correct for this, I'm bumping this as a minor release. It won't affect runtime code, but it may affect your development experience and tests if you were using that parameter.The
Statetype export is also restored, so you shouldn't have issues with installing React Router v6.Oh, by the way, did you hear we released React Router v6?
Full Changelog: remix-run/history@v5.0.3...v5.1.0
v5.0.3Compare Source
Fixed
parsePathadding incorrectly addingsearchv5.0.2Compare Source
Just a couple fixes:
location.statetype toanyand removed the generic onLocationFull Changelog: remix-run/history@v5.0.1...v5.0.2
v5.0.1Compare Source
This patch release contains a tiny TypeScript update to use the built-in
Partialutility forPartialPathandPartialLocation. We always love it when we can ship just a little less code!🙏 Credits
Thanks to @liuhanqu, @hanquliu, @chaance and @mjackson for your contributions!
v5.0.0Compare Source
Today we are very pleased to announce the stable release of history version 5!
Overview
This version includes many enhancements and fixes a few important issues with the library.
New Features
location.statehistory.blockAPI, with support for retrying transitions<script type=module>userswindowobjects)Bugfixes
location.pathnameHistoryLibraryso it doesn't conflict withwindow.HistoryBreaking Changes
pushState)getUserConfirmation,keyLength, andhashTypeAPIsUsage
Please refer to our installation guide for instructions about how to install the library.
There is also a getting started guide as well as a complete API reference in the
docsfolder.We are very excited about this release, especially because it will serve as the foundation for the upcoming release of React Router version 6.
Thank you for your support. Enjoy! 😀
remix-run/react-router (react-router)
v7.7.1Compare Source
Patch Changes
shouldRevalidatereturned false (#14026)Matched leaf route at location "/..." does not have an element or Componentwarnings when error boundaries are rendered. (#14021)v7.7.0Compare Source
Minor Changes
Add unstable RSC support (#13700)
For more information, see the RSC documentation.
Patch Changes
Handle
InvalidCharacterErrorwhen validating cookie signature (#13847)Pass a copy of
searchParamsto thesetSearchParamscallback function to avoid muations of the internalsearchParamsinstance. This was an issue when navigations were blocked because the internal instance be out of sync withuseLocation().search. (#12784)Support invalid
Dateinturbo-streamv2 fork (#13684)In Framework Mode, clear critical CSS in development after initial render (#13872)
Strip search parameters from
patchRoutesOnNavigationpathparam for fetcher calls (#13911)Skip scroll restoration on useRevalidator() calls because they're not new locations (#13671)
Support unencoded UTF-8 routes in prerender config with
ssrset tofalse(#13699)Do not throw if the url hash is not a valid URI component (#13247)
Fix a regression in
createRoutesStubintroduced with the middleware feature. (#13946)As part of that work we altered the signature to align with the new middleware APIs without making it backwards compatible with the prior
AppLoadContextAPI. This permittedcreateRoutesStubto work if you were opting into middleware and the updatedcontexttypings, but brokecreateRoutesStubfor users not yet opting into middleware.We've reverted this change and re-implemented it in such a way that both sets of users can leverage it.
createRoutesStubwith the updated API.Remove
Content-Lengthheader from Single Fetch responses (#13902)v7.6.3Compare Source
Patch Changes
Do not serialize types for
useRouteLoaderData<typeof clientLoader>(#13752)For types to distinguish a
clientLoaderfrom aserverLoader, you MUST annotateclientLoaderargs:v7.6.2Compare Source
Patch Changes
with-propschunk in Framework Mode by moving route module component prop logic from the Vite plugin toreact-router(#13650)headers()function processing for use with RSC (#13639)v7.6.1Compare Source
Patch Changes
Update
Route.MetaArgsto reflect thatdatacan be potentiallyundefined(#13563)This is primarily for cases where a route
loaderthrew an error to it's ownErrorBoundary. but it also arises in the case of a 404 which renders the rootErrorBoundary/metabut the root loader did not run because not routes matched.Partially revert optimization added in
7.1.4to reduce calls tomatchRoutesbecause it surfaced other issues (#13562)Fix typegen when same route is used at multiple paths (#13574)
For example,
routes/route.tsxis used at 4 different paths here:Previously, typegen would arbitrarily pick one of these paths to be the "winner" and generate types for the route module based on that path.
Now, typegen creates unions as necessary for alternate paths for the same route file.
Better types for
params(#13543)For example:
Previously,
paramsfor theroutes/layout.tsxroute were calculated as{ p: string, l: string }.This incorrectly ignores params that could come from child routes.
If visiting
/parent/1/layout/2/child1/3/4, the actual params passed toroutes/layout.tsxwill have a type of{ p: string, l: string, c1a: string, c1b: string }.Now,
paramsare aware of child routes and autocompletion will include child params as optionals:You can also narrow the types for
paramsas it is implemented as a normalized union of params for each page that includesroutes/layout.tsx:UNSTABLE: renamed internal
react-router/route-moduleexport toreact-router/internalUNSTABLE: removed
Infoexport from generated+types/*filesAvoid initial fetcher execution 404 error when Lazy Route Discovery is interrupted by a navigation (#13564)
href replaces splats
*(#13593)v7.6.0Compare Source
Minor Changes
Added a new
react-router.config.tsrouteDiscoveryoption to configure Lazy Route Discovery behavior. (#13451)/__manifestpath:routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }routeDiscovery: { mode: "lazy", manifestPath: "/custom-manifest" }routeDiscovery: { mode: "initial" }Add support for route component props in
createRoutesStub. This allows you to unit test your route components using the props instead of the hooks: (#13528)Patch Changes
Fix
react-routermodule augmentation forNodeNext(#13498)Don't bundle
react-routerinreact-router/domCJS export (#13497)Fix bug where a submitting
fetcherwould get stuck in aloadingstate if a revalidatingloaderredirected (#12873)Fix hydration error if a server
loaderreturnedundefined(#13496)Fix initial load 404 scenarios in data mode (#13500)
Stabilize
useRevalidator'srevalidatefunction (#13542)Preserve status code if a
clientActionthrows adata()result in framework mode (#13522)Be defensive against leading double slashes in paths to avoid
Invalid URLerrors from the URL constructor (#13510)new URL("//", window.location.origin)Remove
Navigatordeclaration fornavigator.connection.saveDatato avoid messing with any other types beyondsaveDatain userland (#13512)Fix
handleErrorparamsvalues on.datarequests for routes with a dynamic param as the last URL segment (#13481)Don't trigger an
ErrorBoundaryUI before the reload when we detect a manifest verison mismatch in Lazy Route Discovery (#13480)Inline
[email protected]dependency and fix decoding ordering of Map/Set instances (#13518)Only render dev warnings in DEV mode (#13461)
UNSTABLE: Fix a few bugs with error bubbling in middleware use-cases (#13538)
Short circuit post-processing on aborted
dataStrategyrequests (#13521)Cannot read properties of undefined (reading 'result')v7.5.3Compare Source
Patch Changes
loaderDatabeing cleared at the handlingErrorBoundaryroute (#13476)clientLoader.hydrateinitial load executions (#13477)v7.5.2Compare Source
Patch Changes
Update Single Fetch to also handle the 204 redirects used in
?_datarequests in Remix v2 (#13364).datarequests from outside the scope of React Router (i.e., anexpress/honomiddleware)Adjust approach for Prerendering/SPA Mode via headers (#13453)
v7.5.1Compare Source
Patch Changes
Fix single fetch bug where no revalidation request would be made when navigating upwards to a reused parent route (#13253)
When using the object-based
route.lazyAPI, theHydrateFallbackandhydrateFallbackElementproperties are now skipped when lazy loading routes after hydration. (#13376)If you move the code for these properties into a separate file, you can use this optimization to avoid downloading unused hydration code. For example:
Properly revalidate prerendered paths when param values change (#13380)
UNSTABLE: Add a new
unstable_runClientMiddlewareargument todataStrategyto enable middleware execution in customdataStrategyimplementations (#13395)UNSTABLE: Add better error messaging when
getLoadContextis not updated to return aMap" (#13242)Do not automatically add
nulltostaticHandler.query()context.loaderDataif routes do not have loaders (#13223)undefinedfrom loaders, our prior check ofloaderData[routeId] !== undefinedwas no longer sufficient and was changed to arouteId in loaderDatacheck - thesenullvalues can cause issues for this new checkcreateStaticHandler()/<StaticRouterProvider>, and usingcontext.loaderDatato control<RouterProvider>hydration behavior on the clientFix prerendering when a loader returns a redirect (#13365)
UNSTABLE: Update context type for
LoaderFunctionArgs/ActionFunctionArgswhen middleware is enabled (#13381)Add support for the new
unstable_shouldCallHandler/unstable_shouldRevalidateArgsAPIs indataStrategy(#13253)v7.5.0Compare Source
Minor Changes
Add granular object-based API for
route.lazyto support lazy loading of individual route properties, for example: (#13294)Breaking change for
route.unstable_lazyMiddlewareconsumersThe
route.unstable_lazyMiddlewareproperty is no longer supported. If you want to lazily load middleware, you must use the new object-basedroute.lazyAPI withroute.lazy.unstable_middleware, for example:Patch Changes
unstable_subResourceIntegrityfuture flag that enables generation of an importmap with integrity for the scripts that will be loaded by the browser. (#13163)v7.4.1Compare Source
Patch Changes
Fix types on
unstable_MiddlewareFunctionto avoid type errors when a middleware doesn't return a value (#13311)Dedupe calls to
route.lazyfunctions (#13260)Add support for
route.unstable_lazyMiddlewarefunction to allow lazy loading of middleware logic. (#13210)Breaking change for
unstable_middlewareconsumersThe
route.unstable_middlewareproperty is no longer supported in the return value fromroute.lazy. If you want to lazily load middleware, you must useroute.unstable_lazyMiddleware.v7.4.0Compare Source
Patch Changes
shouldRevalidatebehavior forclientLoader-only routes inssr:trueapps (#13221)RequestHandlerloadContextparameter type when middleware is enabled (#13204)Route.unstable_MiddlewareFunctionto have a return value ofResponse | undefinedinstead ofResponse | voidbecaue you should not return anything if you aren't returning theResponse(#13199)next()and are no longer leaking theMiddlewareErrorimplementation detail (#13180)v7.3.0Compare Source
Minor Changes
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)
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.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:v7.2.0Compare Source
Minor Changes
New type-safe
hrefutility that guarantees links point to actual paths in your app (#13012)Patch Changes
Fix typegen for repeated params (#13012)
In React Router, path parameters are keyed by their name.
So for a path pattern like
/a/:id/b/:id?/c/:id, the last:idwill set the value foridinuseParamsand theparamsprop.For example,
/a/1/b/2/c/3will result in the value{ id: 3 }at runtime.Previously, generated types for params incorrectly modeled repeated params with an array.
So
/a/1/b/2/c/3generated a type like{ id: [1,2,3] }.To be consistent with runtime behavior, the generated types now correctly model the "last one wins" semantics of path parameters.
So
/a/1/b/2/c/3now generates a type like{ id: 3 }.Don't apply Single Fetch revalidation de-optimization when in SPA mode since there is no server HTTP request (#12948)
Properly handle revalidations to across a prerender/SPA boundary (#13021)
.datarequests if the path wasn't pre-rendered because the request will 404loaderdata inssr:falsemode is static because it's generated at build timeclientLoaderto do anything dynamicloaderand not aclientLoader, we disable revalidation by default because there is no new data to retrieve.datarequest logic if there are no server loaders withshouldLoad=truein our single fetchdataStrategy.datarequest that would 404 after a submissionError at build time in
ssr:false+prerenderapps for the edge case scenario of: (#13021)loader(does not have aclientLoader)loaderDatabecause there is no server on which to run theloaderclientLoaderor pre-rendering the child pathsclientLoader, calling theserverLoader()on non-prerendered paths will throw a 404Add unstable support for splitting route modules in framework mode via
future.unstable_splitRouteModules(#11871)Add
unstable_SerializesTobrand type for library authors to register types serializable by React Router's streaming format (turbo-stream) (ab5b05b02)Align dev server behavior with static file server behavior when
ssr:falseis set (#12948)prerenderconfig exists, only SSR down to the rootHydrateFallback(SPA Mode)prerenderconfig exists but the current path is not prerendered, only SSR down to the rootHydrateFallback(SPA Fallback).datarequests to non-pre-rendered pathsImprove prefetch performance of CSS side effects in framework mode (#12889)
Disable Lazy Route Discovery for all
ssr:falseapps and not just "SPA Mode" because there is no runtime server to serve the search-param-configured__manifestrequests (#12894)ssr:falseand noprerenderconfig but we realized it should apply to allssr:falseapps, including those prerendering multiple pagesprerenderscenarios we would prerender the/__manifestfile assuming the static file server would serve it but that makes some unneccesary assumptions about the static file server behaviorsProperly handle interrupted manifest requests in lazy route discovery (#12915)
v7.1.5Compare Source
Patch Changes
7.1.4via #12800 that caused issues navigating to hash routes inside splat routes for applications using Lazy Route Discovery (patchRoutesOnNavigation) (#12927)v7.1.4Compare Source
Patch Changes
text/plainorapplication/jsonresponses (#12848).dataextension.datarequest, they will still be encoded viaturbo-streamquerySelectorAllcall at thebodylevel instead of many calls at the sub-tree level (#12731)errorHeaderswhen throwing adata()result (#12846)Set-Cookieheaders could be duplicated if also returned fromheadersmatchRoutescalls when possible (#12800)v7.1.3Compare Source
No changes
v7.1.2Compare Source
Patch Changes
Fix issue with fetcher data cleanup in the data layer on fetcher unmount (#12681)
Do not rely on
symbolfor filtering outredirectresponses from loader data (#12694)Previously, some projects were getting type checking errors like:
Now that
symbols are not used for theredirectresponse type, these errors should no longer be present.v7.1.1Compare Source
No changes
v7.1.0Compare Source
Patch Changes
<Link prefetch>warning which suffers from false positives in a lazy route discovery world (#12485)v7.0.2Compare Source
Patch Changes
temporarily only use one build in export map so packages can have a peer dependency on react router (#12437)
Generate wide
matchesandparamstypes for current route and child routes (#12397)At runtime,
matchesincludes child route matches andparamsinclude child route path parameters.But previously, we only generated types for parent routes in
matches; forparams, we only considered the parent routes and the current route.To align our generated types more closely to the runtime behavior, we now generate more permissive, wider types when accessing child route information.
v7.0.1Compare Source
No changes
v7.0.0Compare Source
Major Changes
Remove the original
deferimplementation in favor of using raw promises via single fetch andturbo-stream. This removes these exports from React Router: (#11744)deferAbortedDeferredErrortype TypedDeferredDataUNSAFE_DeferredDataUNSAFE_DEFERRED_SYMBOL,@remix-run/routerintoreact-router(#11505)react-router-domintoreact-router@remix-run/server-runtimeintoreact-router@remix-run/testingintoreact-routerRemove single fetch future flag. (#11522)
Drop support for Node 16, React Router SSR now requires Node 18 or higher (#11391)
Remove
future.v7_startTransitionflag (#11696)useNavigate()useSubmituseFetcher().loaduseFetcher().submituseRevalidator.revalidateRemove
future.v7_normalizeFormMethodfuture flag (#11697)For Remix consumers migrating to React Router, the
cryptoglobal from the Web Crypto API is now required when using cookie and session APIs. This means that the following APIs are provided fromreact-routerrather than platform-specific packages: (#11837)createCookiecreateCookieSessionStoragecreateMemorySessionStoragecreateSessionStorageFor consumers running older versions of Node, the
installGlobalsfunction from@remix-run/nodehas been updated to defineglobalThis.crypto, using Node'srequire('node:crypto').webcryptoimplementation.Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
createCookieFactorycreateSessionStorageFactorycreateCookieSessionStorageFactorycreateMemorySessionStorageFactoryImports/Exports cleanup (#11840)
@remix-run/routerAgnosticDataIndexRouteObjectAgnosticDataNonIndexRouteObjectAgnosticDataRouteMatchAgnosticDataRouteObjectAgnosticIndexRouteObjectAgnosticNonIndexRouteObjectAgnosticRouteMatchAgnosticRouteObjectTrackedPromiseunstable_AgnosticPatchRoutesOnMissFunctionAction-> exported asNavigationTypeviareact-routerRouterexported asDataRouterto differentiate from RR's<Router>getToPathname(@private)joinPaths(@private)normalizePathname(@private)resolveTo(@private)stripBasename(@private)createBrowserHistory-> in favor ofcreateBrowserRoutercreateHashHistory-> in favor ofcreateHashRoutercreateMemoryHistory-> in favor ofcreateMemoryRoutercreateRoutercreateStaticHandler-> in favor of wrappercreateStaticHandlerin RR DomgetStaticContextFromErrorreact-routerHashPathnameSearchupdate minimum node version to 18 (#11690)
Remove
future.v7_prependBasenamefrom the ionternalized@remix-run/routerpackage (#11726)Migrate Remix type generics to React Router (#12180)
Route.*typesRoute.*typesuseFetcherpreviously had an optional generic (used primarily by Remix v2) that expected the data typetypeof loader/typeof action)useFetcher<LoaderData>()useFetcher<typeof loader>()Remove
future.v7_throwAbortReasonfrom internalized@remix-run/routerpackage (#11728)Add
exportsfield to all packages (#11675)node package no longer re-exports from react-router (#11702)
renamed RemixContext to FrameworkContext (#11705)
updates the minimum React version to 18 (#11689)
PrefetchPageDescriptor replaced by PageLinkDescriptor (#11960)
@remix-run/router,@remix-run/server-runtime, and@remix-run/reactnow that they all live inreact-router(#12177)LoaderFunction,LoaderFunctionArgs,ActionFunction,ActionFunctionArgs,DataFunctionArgs,RouteManifest,LinksFunction,Route,EntryRouteRouteManifesttype used by the "remix" code is now slightly stricter because it is using the former@remix-run/routerRouteManifestRecord<string, Route> -> Record<string, Route | undefined>AppDatatype in favor of inliningunknownin the few locations it was usedServerRuntimeMeta*types in favor of theMeta*types they were duplicated fromfuture.v7_partialHydrationflag (#11725)<RouterProvider fallbackElement>propfallbackElementto ahydrateFallbackElement/HydrateFallbackon your root routefuture.v7_partialHydration(when usingfallbackElement),state.navigationwas populated during the initial loadfuture.v7_partialHydration,state.navigationremains in an"idle"state during the initial loadRemove
v7_relativeSplatPathfuture flag (#11695)Drop support for Node 18, update minimum Node vestion to 20 (#12171)
Configuration
📅 Schedule: Branch creation - "before 3am on the first day of the month" in timezone America/New_York, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
This PR was generated by Mend Renovate. View the repository job log.