Closed
Conversation
Contributor
Author
|
bcba7c5 to
b770bc2
Compare
99412ba to
fd89d9a
Compare
c2812c6 to
f56da23
Compare
6d64226 to
0473c3a
Compare
0473c3a to
17a0e3b
Compare
17a0e3b to
56a6307
Compare
Collaborator
|
We need to update the react-router peer dependency in Comet first. |
Contributor
Author
Renovate Ignore NotificationBecause you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR. |
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 contains the following updates:
^5.3.4->^7.3.0^5.3.4->^7.3.0Release Notes
remix-run/react-router (react-router)
v7.3.0Compare Source
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)
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: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)
installGlobals()as this should no longer be necessaryRemove remaining future flags (#11820)
v7_skipActionErrorRevalidationv3_fetcherPersist,v3_relativeSplatPath,v3_throwAbortReasonrename createRemixStub to createRoutesStub (#11692)
Remove
@remix-run/routerdeprecateddetectErrorBoundaryoption in favor ofmapRouteProperties(#11751)Add
react-router/domsubpath export to properly enablereact-domas an optionalpeerDependency(#11851)import ReactDOM from "react-dom"in<RouterProvider>in order to accessReactDOM.flushSync(), since that would breakcreateMemoryRouteruse cases in non-DOM environmentsreact-router/domto get the proper component that makesReactDOM.flushSync()available:entry.client.tsx:import { HydratedRouter } from 'react-router/dom'createBrowserRouter/createHashRouter:import { RouterProvider } from "react-router/dom"Remove
future.v7_fetcherPersistflag (#11731)Update
cookiedependency to^1.0.1- please see the release notes for any breaking changes (#12172)Minor Changes
prerenderconfig in the React Router vite plugin, to support existing SSG use-cases (#11539)prerenderconfig to pre-render your.htmland.datafiles at build time and then serve them statically at runtime (either from a running server or a CDN)prerendercan either be an array of string paths, or a function (sync or async) that returns an array of strings so that you can dynamically generate the paths by talking to your CMS, etc.Params, loader data, and action data as props for route component exports (#11961)
Remove duplicate
RouterProviderimpliementations (#11679)Typesafety improvements (#12019)
React Router now generates types for each of your route modules.
You can access those types by importing them from
./+types.<route filename without extension>.For example:
This initial implementation targets type inference for:
Params: Path parameters from your routing config inroutes.tsincluding file-based routingLoaderData: Loader data fromloaderand/orclientLoaderwithin your route moduleActionData: Action data fromactionand/orclientActionwithin your route moduleIn the future, we plan to add types for the rest of the route module exports:
meta,links,headers,shouldRevalidate, etc.We also plan to generate types for typesafe
Links:Check out our docs for more:
Stabilize
unstable_dataStrategy(#11969)Stabilize
unstable_patchRoutesOnNavigation(#11970)Patch Changes
No changes (
506329c4e)chore: re-enable development warnings through a
developmentexports condition. (#12269)Remove unstable upload handler. (#12015)
Remove unneeded dependency on @web3-storage/multipart-parser (#12274)
Fix redirects returned from loaders/actions using
data()(#12021)fix(react-router): (v7) fix static prerender of non-ascii characters (#12161)
Replace
substrwithsubstring(#12080)Remove the deprecated
jsonutility (#12146)Response.jsonif you still need to construct JSON responses in your appRemove unneeded dependency on source-map (#12275)
v6.30.0: v6.30.0Compare Source
See the changelog for release notes: https://github.com/remix-run/react-router/blob/main/CHANGELOG.md#v6300
v6.29.0: v6.29.0Compare Source
See the changelog for release notes: https://github.com/remix-run/react-router/blob/main/CHANGELOG.md#v6290
v6.28.2: v6.28.2Compare Source
See the changelog for release notes: https://github.com/remix-run/react-router/blob/main/CHANGELOG.md#v6282
v6.28.1: v6.28.1Compare Source
See the changelog for release notes: https://github.com/remix-run/react-router/blob/main/CHANGELOG.md#v6281
v6.28.0Compare Source
Minor Changes
json/deferin favor of returning raw objectsPatch Changes
@remix-run/router@1.21.0v6.27.0Compare Source
Minor Changes
unstable_patchRoutesOnNavigation(#11973)PatchRoutesOnNavigationFunctionArgstype for convenience (#11967)unstable_dataStrategy(#11974)unstable_flushSyncoption for navigations and fetchers (#11989)unstable_viewTransitionoption for navigations and the correspondingunstable_useViewTransitionStatehook (#11989)Patch Changes
Fix bug when submitting to the current contextual route (parent route with an index child) when an
?indexparam already exists from a prior submission (#12003)Fix
useFormActionbug - when removing?indexparam it would not keep other non-Remixindexparams (#12003)Fix types for
RouteObjectwithinPatchRoutesOnNavigationFunction'spatchmethod so it doesn't expect agnostic route objects passed topatch(#11967)Updated dependencies:
@remix-run/router@1.20.0v6.26.2Compare Source
Patch Changes
@remix-run/router@1.19.2v6.26.1Compare Source
Patch Changes
unstable_patchRoutesOnMisstounstable_patchRoutesOnNavigationto match new behavior (#11888)@remix-run/router@1.19.1v6.26.0Compare Source
Minor Changes
replace(url, init?)alternative toredirect(url, init?)that performs ahistory.replaceStateinstead of ahistory.pushStateon client-side navigation redirects (#11811)Patch Changes
future.v7_partialHydrationalong withunstable_patchRoutesOnMiss(#11838)router.state.matcheswill now include any partial matches so that we can render ancestorHydrateFallbackcomponents@remix-run/router@1.19.0v6.25.1Compare Source
No significant changes to this package were made in this release. See the repo
CHANGELOG.mdfor an overview of all changes in v6.25.1.v6.25.0Compare Source
Minor Changes
future.unstable_skipActionErrorRevalidationasfuture.v7_skipActionErrorRevalidation(#11769)Responsewith a4xx/5xxstatus codeshouldRevalidateshouldRevalidate'sunstable_actionStatusparameter toactionStatusPatch Changes
useMatchso matches/params reflect decoded params (#11789)@remix-run/router@1.18.0v6.24.1Compare Source
Patch Changes
future.v7_relativeSplatPath, properly resolve relative paths in splat routes that are children of pathless routes (#11633)@remix-run/router@1.17.1v6.24.0Compare Source
Minor Changes
unstable_patchRoutesOnMissdocs: https://reactrouter.com/v6/routers/create-browser-routerPatch Changes
@remix-run/router@1.17.0v6.23.1Compare Source
Patch Changes
<Await>(#11513)@remix-run/router@1.16.1v6.23.0Compare Source
Minor Changes
unstable_dataStrategyconfiguration option (#11098)Patch Changes
@remix-run/router@1.16.0v6.22.3Compare Source
Patch Changes
@remix-run/router@1.15.3v6.22.2Compare Source
Patch Changes
@remix-run/router@1.15.2v6.22.1Compare Source
Patch Changes
@remix-run/router@1.15.1v6.22.0Compare Source
Patch Changes
@remix-run/router@1.15.0v6.21.3Compare Source
Patch Changes
unstable_prefix fromBlocker/BlockerFunctiontypes (#11187)v6.21.2Compare Source
Patch Changes
@remix-run/router@1.14.2v6.21.1Compare Source
Patch Changes
route.lazynot working correctly on initial SPA load whenv7_partialHydrationis specified (#11121)@remix-run/router@1.14.1v6.21.0Compare Source
Minor Changes
Add a new
future.v7_relativeSplatPathflag to implement a breaking bug fix to relative routing when inside a splat route. (#11087)This fix was originally added in #10983 and was later reverted in #11078 because it was determined that a large number of existing applications were relying on the buggy behavior (see #11052)
The Bug
The buggy behavior is that without this flag, the default behavior when resolving relative paths is to ignore any splat (
*) portion of the current route path.The Background
This decision was originally made thinking that it would make the concept of nested different sections of your apps in
<Routes>easier if relative routing would replace the current splat:Any paths like
/dashboard,/dashboard/team,/dashboard/projectswill match theDashboardroute. The dashboard component itself can then render nested<Routes>:Now, all links and route paths are relative to the router above them. This makes code splitting and compartmentalizing your app really easy. You could render the
Dashboardas its own independent app, or embed it into your large app without making any changes to it.The Problem
The problem is that this concept of ignoring part of a path breaks a lot of other assumptions in React Router - namely that
"."always means the current location pathname for that route. When we ignore the splat portion, we start getting invalid paths when using".":We've also introduced an issue that we can no longer move our
DashboardTeamcomponent around our route hierarchy easily - since it behaves differently if we're underneath a non-splat route, such as/dashboard/:widget. Now, our"."links will, properly point to ourself inclusive of the dynamic param value so behavior will break from it's corresponding usage in a/dashboard/*route.Even worse, consider a nested splat route configuration:
Now, a
<Link to=".">and a<Link to="..">inside theDashboardcomponent go to the same place! That is definitely not correct!Another common issue arose in Data Routers (and Remix) where any
<Form>should post to it's own routeactionif you the user doesn't specify a form action:This is just a compounded issue from the above because the default location for a
Formto submit to is itself (".") - and if we ignore the splat portion, that now resolves to the parent route.The Solution
If you are leveraging this behavior, it's recommended to enable the future flag, move your splat to it's own route, and leverage
../for any links to "sibling" pages:This way,
.means "the full current pathname for my route" in all cases (including static, dynamic, and splat routes) and..always means "my parents pathname".Patch Changes
@remix-run/router@1.14.0v6.20.1Compare Source
Patch Changes
useResolvedPathfix for splat routes due to a large number of applications that were relying on the buggy behavior (see #11052 (comment)). We plan to re-introduce this fix behind a future flag in the next minor version. (#11078)@remix-run/router@1.13.1v6.20.0Compare Source
Minor Changes
PathParamtype from the public API (#10719)Patch Changes
resolveToin splat routes ([#11045](https://redirect.giConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), 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.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.