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.11.05.3.4β7.11.0Release 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.11.0Compare Source
Minor Changes
<HydratedRouter onError>/<RouterProvider onError>(#β14546)Patch Changes
add support for throwing redirect Response's at RSC render time (#β14596)
Support for throwing
data()and Response from server component render phase. Response body is not serialized as async work is not allowed as error encoding phase. If you wish to transmit data to the boundary, throwdata()instead. (#β14632)Fix
unstable_useTransitionsprop on<Router>component to permit omission for backewards compatibility (#β14646)routeRSCServerRequestreplacefetchServerwithserverResponse(#β14597)[UNSTABLE] Add a new
unstable_defaultShouldRevalidateflag to various APIs to allow opt-ing out of standard revalidation behaviors. (#β14542)If active routes include a
shouldRevalidatefunction, then your value will be passed asdefaultShouldRevalidatein those function so that the route always has the final revalidation determination.<Form method="post" unstable_defaultShouldRevalidate={false}>submit(data, { method: "post", unstable_defaultShouldRevalidate: false })<fetcher.Form method="post" unstable_defaultShouldRevalidate={false}>fetcher.submit(data, { method: "post", unstable_defaultShouldRevalidate: false })This is also available on non-submission APIs that may trigger revalidations due to changing search params:
<Link to="/" unstable_defaultShouldRevalidate={false}>navigate("/?foo=bar", { unstable_defaultShouldRevalidate: false })setSearchParams(params, { unstable_defaultShouldRevalidate: false })Allow redirects to be returned from client side middleware (#β14598)
Handle
dataStrategyimplementations that return insufficient result sets by adding errors for routes without any available result (#β14627)v7.10.1Compare Source
Patch Changes
useOptimisticstub we provide for React 18 users to use a stable setter function to avoid potentialuseEffectloops - specifically when using<Link viewTransition>(#β14628)v7.10.0Compare Source
Minor Changes
Stabilize
fetcher.reset()(#β14545)fetcher.unstable_reset()Stabilize the
dataStrategymatch.shouldRevalidateArgs/match.shouldCallHandler()APIs. (#β14592)The
match.shouldLoadAPI is now marked deprecated in favor of these more powerful alternativesIf you're using this API in a custom
dataStrategytoday, you can swap to the new API at your convenience:match.shouldRevalidateArgsis the argument that will be passed to the routeshouldRevaliatefunctionCombined with the parameter accepted by
match.shouldCallHandler, you can define a custom revalidation behavior for yourdataStrategy:Patch Changes
Fix a Framework Mode bug where the
defaultShouldRevalidateparameter toshouldRevalidatewould not be correct afteractionreturned a 4xx/5xx response (truewhen it should have beenfalse) (#β14592)shouldRevalidatefunction relied on that parameter, you may have seen unintended revalidationsFix
fetcher.submitfailing with plain objects containing atagNameproperty (#β14534)[UNSTABLE] Add
unstable_patternto the parameters for client sideunstable_onError, refactor how it's called byRouterProviderto avoid potential strict mode issues (#β14573)Add new
unstable_useTransitionsflag to routers to give users control over the usage ofReact.startTransitionandReact.useOptimistic. (#β14524)<HydratedRouter unstable_transition>/<RouterProvider unstable_transition>React.startTransitionReact.startTransitiontrueif you run into this scenario to get the enhanceduseOptimisticbehavior (requires React 19)trueReact.startTransition(as they are without the flag)Link/Formnavigations will be wrapped inReact.startTransitionReact.useOptimistic(i.e.,useNavigation(),useFetchers(), etc.)falseReact.startTransitionorReact.useOptimisticon any navigations or state changes<BrowserRouter unstable_useTransitions>React.startTransitiontrueReact.startTransition(as they are without the flag)Link/Formnavigations will be wrapped inReact.startTransitionfalseReact.startTransitionon any navigations or state changesFix the promise returned from
useNavigatein Framework/Data Mode so that it properly tracks the duration ofpopstatenavigations (i.e.,navigate(-1)) (#β14524)Fix internal type error in useRoute types that surfaces when skipLibCheck is disabled (#β14577)
Preserve
statusTexton theErrorResponseinstance when throwingdata()from a route handler (#β14555)Optimize href() to avoid backtracking regex on splat (#β14329)
v7.9.6Compare Source
Patch Changes
[UNSTABLE] Add
location/paramsas arguments to client-sideunstable_onErrorto permit enhanced error reporting. (#β14509)unstable_onError. The seconderrorInfoparameter is now an object withlocationandparams:Properly handle ancestor thrown middleware errors before
next()on fetcher submissions (#β14517)Fix issue with splat routes interfering with multiple calls to patchRoutesOnNavigation (#β14487)
Normalize double-slashes in
resolvePath(#β14529)v7.9.5Compare Source
Patch Changes
Move RSCHydratedRouter and utils to
/domexport. (#β14457)useRoute: return type-safe
handle(#β14462)For example:
Ensure action handlers run for routes with middleware even if no loader is present (#β14443)
Add
unstable_instrumentationsAPI to allow users to add observablity to their apps by instrumenting route loaders, actions, middlewares, lazy, as well as server-side request handlers and client side navigations/fetches (#β14412)entry.server.tsx:export const unstable_instrumentations = [...]entry.client.tsx:<HydratedRouter unstable_instrumentations={[...]} />createBrowserRouter(routes, { unstable_instrumentations: [...] })This also adds a new
unstable_patternparameter to loaders/actions/middleware which contains the un-interpolated route pattern (i.e.,/blog/:slug) which is useful for aggregating performance metrics by routev7.9.4Compare Source
Patch Changes
handle external redirects in from server actions (#β14400)
New (unstable)
useRoutehook for accessing data from specific routes (#β14407)For example, let's say you have an
adminroute somewhere in your app and you want any child routes ofadminto all have access to theloaderDataandactionDatafromadmin.You might even want to create a reusable widget that all of the routes nested under
admincould use:In framework mode,
useRouteknows all your app's routes and gives you TS errors when invalid route IDs are passed in:useRoutereturnsundefinedif the route is not part of the current page:Note: the
rootroute is the exception since it is guaranteed to be part of the current page.As a result,
useRoutenever returnsundefinedforroot.loaderDataandactionDataare marked as optional since they could be accessed before theactionis triggered or after theloaderthrew an error:If instead of a specific route, you wanted access to the current route's
loaderDataandactionData, you can calluseRoutewithout arguments:This usage is equivalent to calling
useLoaderDataanduseActionData, but consolidates all route data access into one hook:useRoute.Note: when calling
useRoute()(without a route ID), TS has no way to know which route is the current route.As a result,
loaderDataandactionDataare typed asunknown.If you want more type-safety, you can either narrow the type yourself with something like
zodor you can refactor your app to pass down typed props to yourAdminWidget:v7.9.3Compare Source
Patch Changes
Do not try to use
turbo-streamto decode CDN errors that never reached the server (#β14385)Fix Data Mode regression causing a 404 during initial load in when
middlewareexists without anyloaderfunctions (#β14393)v7.9.2Compare Source
Patch Changes
middlewareon initial load even if no loaders exist (#β14348)createRoutesStubto run route middleware<RoutesStub future={{ v8_middleware: true }} />flag to enable the propercontexttypeUpdate Lazy Route Discovery manifest requests to use a singular comma-separated
pathsquery param instead of repeatedpquery params (#β14321)[UNSTABLE] Add
fetcher.unstable_reset()API (#β14206)Made useOutlet element reference have stable identity in-between route chages (#β13382)
feat: enable full transition support for the rsc router (#β14362)
In RSC Data Mode, handle SSR'd client errors and re-try in the browser (#β14342)
Support
middlewareprop on<Route>for usage with a data router viacreateRoutesFromElements(#β14357)Handle encoded question mark and hash characters in ancestor splat routes (#β14249)
Fail gracefully on manifest version mismatch logic if
sessionStorageaccess is blocked (#β14335)v7.9.1Compare Source
Patch Changes
Futureinterface naming frommiddleware->v8_middleware(#β14327)v7.9.0Compare Source
Minor Changes
Stabilize middleware and context APIs. (#β14215)
We have removed the
unstable_prefix from the following APIs and they are now considered stable and ready for production use:RouterContextProvidercreateContextcreateBrowserRoutergetContextoption<HydratedRouter>getContextpropPlease see the Middleware Docs, the Middleware RFC, and the Client-side Context RFC for more information.
Patch Changes
meta()JSON-LD content (#β14316)hreffunction available in a react-server context (#β14262)getPayload()is called to allow for "in-context" decoding and hoisting of contextual assets (#β14248)href()now correctly processes routes that have an extension after the parameter or are a single optional parameter. (#β13797)v7.8.2Compare Source
Patch Changes
[UNSTABLE] Remove Data Mode
future.unstable_middlewareflag fromcreateBrowserRouter(#β14213)getLoadContexttype behavior change[UNSTABLE] Add
<RouterProvider unstable_onError>/<HydratedRouter unstable_onError>prop for client side error reporting (#β14162)server action revalidation opt out via $SKIP_REVALIDATION field (#β14154)
Properly escape interpolated param values in
generatePath()(#β13530)Maintain
ReadonlyMapandReadonlySettypes in server response data. (#β13092)[UNSTABLE] Delay serialization of
.dataredirects to 202 responses until after middleware chain (#β14205)Fix
TypeErrorif you throw frompatchRoutesOnNavigationwhen no partial matches exist (#β14198)Fix
basenameusage without a leading slash in data routers (#β11671)[UNSTABLE] Update client middleware so it returns the data strategy results allowing for more advanced post-processing middleware (#β14151)
v7.8.1Compare Source
Patch Changes
matchPath(#β11813)basenameis set withssr:false(#β13791)isRouteErrorResponseutility inreact-serverenvironments (#β14166)metaandlinksRoute Exports in RSC Data Mode (#β14136)data()values toResponseinstances viaResponse.json()in resource routes and middleware (#β14159, #β14181)v7.8.0Compare Source
Minor Changes
nonceprop toLinks&PrefetchPageLinks(#β14048)loaderDataarguments/properties alongside existingdataarguments/properties to provide consistency and clarity betweenloaderDataandactionDataacross the board (#β14047)Route.MetaArgs,Route.MetaMatch,MetaArgs,MetaMatch,Route.ComponentProps.matches,UIMatch@deprecatedwarnings have been added to the existingdataproperties to point users to newloaderDataproperties, in preparation for removing thedataproperties in a future major releasePatch Changes
Prevent "Did not find corresponding fetcher result" console error when navigating during a
fetcher.submitrevalidation (#β14114)Bubble client-side middleware errors prior to
nextto the appropriate ancestor error boundary (#β14138)Switch Lazy Route Discovery manifest URL generation to usea standalone
URLSearchParamsinstance instead ofURL.searchParamsto avoid a major performance bottleneck in Chrome (#β14084)Adjust internal RSC usage of
React.useto avoid Webpack compilation errors when using React 18 (#β14113)Remove dependency on
@types/nodein TypeScript declaration files (#β14059)Fix types for
UIMatchto reflect that theloaderData/dataproperties may beundefined(#β12206)ErrorBoundaryis being rendered, not all active matches will have loader data available, since it may have been theirloaderthat threw to trigger the boundaryUIMatch.datatype was not correctly handing this and would always reflect the presence of data, leading to the unexpected runtime errors when anErrorBoundarywas renderedmatch.dataaccesses - you should properly guard forundefinedvalues in those scenarios.[UNSTABLE] Ensure resource route errors go through
handleErrorw/middleware enabled (#β14078)[UNSTABLE] Propagate returned Response from server middleware if next wasn't called (#β14093)
[UNSTABLE] Allow server middlewares to return
data()values which will be converted into aResponse(#β14093)[UNSTABLE] Update middleware error handling so that the
nextfunction never throws and instead handles any middleware errors at the properErrorBoundaryand returns theResponseup through the ancestornextfunction (#β14118)[UNSTABLE] When middleware is enabled, make the
contextparameter read-only (viaReadonly<unstable_RouterContextProvider>) so that TypeScript will not allow you to write arbitrary fields to it in loaders, actions, or middleware. (#β14097)[UNSTABLE] Rename and alter the signature/functionality of the
unstable_respondAPI instaticHandler.query/staticHandler.queryRoute(#β14103)unstable_generateMiddlewareResponsefor clarityunstable_respondand handing you the result, we now pass aquery/queryRoutefunction as a parameter and you execute the loaders/actions inside your callback, giving you full access to pre-processing and error handlingqueryversion of the API now has a signature of(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>queryRouteversion of the API now has a signature of(queryRoute: (r: Request) => Promise<Response>) => Promise<Response>queryand direct error handling of errors thrown from querystaticHandlerunstable_respondAPI[UNSTABLE] Convert internal middleware implementations to use the new
unstable_generateMiddlewareResponseAPI (#β14103)[UNSTABLE] Change
getLoadContextsignature (type GetLoadContextFunction) whenfuture.unstable_middlewareis enabled so that it returns anunstable_RouterContextProviderinstance instead of aMapused to contruct the instance internally (#β14097)type unstable_InitialContextexportgetLoadContextfunction[UNSTABLE] Run client middleware on client navigations even if no loaders exist (#β14106)
[UNSTABLE] Change the
unstable_getContextsignature onRouterProvider/HydratedRouter/unstable_RSCHydratedRouterso that it returns anunstable_RouterContextProviderinstance instead of aMapused to contruct the instance internally (#β14097)unstable_getContextprop[UNSTABLE] proxy server action side-effect redirects from actions for document and callServer requests (#β14131)
[UNSTABLE] Fix RSC Data Mode issue where routes that return
falsefromshouldRevalidatewould be replaced by an<Outlet />(#β14071)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](https://redirect.github.com/remix-run/rConfiguration
π 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.