react-router 6.2.2 → 6.4.0-pre.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +134 -0
- package/LICENSE.md +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.js +1269 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/components.d.ts +161 -0
- package/dist/lib/context.d.ts +48 -0
- package/dist/lib/hooks.d.ts +163 -0
- package/dist/lib/use-sync-external-store-shim/index.d.ts +6 -0
- package/dist/lib/use-sync-external-store-shim/useSyncExternalStoreShimClient.d.ts +7 -0
- package/dist/lib/use-sync-external-store-shim/useSyncExternalStoreShimServer.d.ts +9 -0
- package/{main.js → dist/main.js} +1 -1
- package/dist/react-router.development.js +1239 -0
- package/dist/react-router.development.js.map +1 -0
- package/dist/react-router.production.min.js +12 -0
- package/dist/react-router.production.min.js.map +1 -0
- package/dist/umd/react-router.development.js +1379 -0
- package/dist/umd/react-router.development.js.map +1 -0
- package/dist/umd/react-router.production.min.js +12 -0
- package/dist/umd/react-router.production.min.js.map +1 -0
- package/package.json +27 -18
- package/index.d.ts +0 -341
- package/index.js +0 -971
- package/index.js.map +0 -1
- package/react-router.development.js +0 -925
- package/react-router.development.js.map +0 -1
- package/react-router.production.min.js +0 -12
- package/react-router.production.min.js.map +0 -1
- package/umd/react-router.development.js +0 -1020
- package/umd/react-router.development.js.map +0 -1
- package/umd/react-router.production.min.js +0 -12
- package/umd/react-router.production.min.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# react-router
|
|
2
|
+
|
|
3
|
+
## 6.4.0-pre.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: Deferred API Updates (#9070)
|
|
8
|
+
|
|
9
|
+
- Removes `<Suspense>` from inside `<Deferred>`, requires users to render their own suspense boundaries
|
|
10
|
+
- Updates `Deferred` to use a true error boundary to catch render errors as well as data errors
|
|
11
|
+
- Support array and single promise usages
|
|
12
|
+
- `return deferred([ await critical(), lazy() ])`
|
|
13
|
+
- `return deferred(lazy())`
|
|
14
|
+
- Remove `Deferrable`/`ResolvedDeferrable` in favor of raw `Promise`'s and `Awaited`
|
|
15
|
+
- Remove generics from `useDeferredData` until `useLoaderData` generic is decided in 6.5
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @remix-run/router@0.2.0-pre.5
|
|
19
|
+
|
|
20
|
+
## 6.4.0-pre.9
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Feat: adds `deferred` support to data routers (#9002)
|
|
25
|
+
|
|
26
|
+
Returning a `deferred` from a `loader` allows you to separate _critical_ loader data that you want to wait for prior to rendering the destination page from _non-critical_ data that you are OK to show a spinner for until it loads.
|
|
27
|
+
|
|
28
|
+
```jsx
|
|
29
|
+
// In your route loader, return a deferred() and choose per-key whether to
|
|
30
|
+
// await the promise or not. As soon as the awaited promises resolve, the
|
|
31
|
+
// page will be rendered.
|
|
32
|
+
function loader() {
|
|
33
|
+
return deferred({
|
|
34
|
+
critical: await getCriticalData(),
|
|
35
|
+
lazy: getLazyData(),
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// In your route element, grab the values from useLoaderData and render them
|
|
40
|
+
// with <Deferred>
|
|
41
|
+
function DeferredPage() {
|
|
42
|
+
let data = useLoaderData();
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<p>Critical Data: {data.critical}</p>
|
|
46
|
+
<Suspense fallback={<p>Loading...</p>}>
|
|
47
|
+
<Deferred value={data.lazy} errorElement={<RenderDeferredError />}>
|
|
48
|
+
<RenderDeferredData />
|
|
49
|
+
</Deferred>
|
|
50
|
+
</Suspense>
|
|
51
|
+
</>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Use separate components to render the data once it resolves, and access it
|
|
56
|
+
// via the useDeferredData hook
|
|
57
|
+
function RenderDeferredData() {
|
|
58
|
+
let data = useDeferredData();
|
|
59
|
+
return <p>Lazy: {data}</p>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function RenderDeferredError() {
|
|
63
|
+
let data = useRouteError();
|
|
64
|
+
return <p>Error! {data.message} {data.stack}</p>;
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
If you want to skip the separate components, you can use the Render Props
|
|
69
|
+
pattern and handle the rendering of the deferred data inline:
|
|
70
|
+
|
|
71
|
+
```jsx
|
|
72
|
+
function DeferredPage() {
|
|
73
|
+
let data = useLoaderData();
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<p>Critical Data: {data.critical}</p>
|
|
77
|
+
<Suspense fallback={<p>Loading...</p>}>
|
|
78
|
+
<Deferred value={data.lazy} errorElement={<RenderDeferredError />}>
|
|
79
|
+
{(data) => <p>{data}</p>}
|
|
80
|
+
</Deferred>
|
|
81
|
+
</Suspense>
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- feat: add basename support for data routers (#9026)
|
|
88
|
+
- fix: Fix trailing slash behavior on pathless routing when using a basename (#9045)
|
|
89
|
+
- Updated dependencies
|
|
90
|
+
- @remix-run/router@0.2.0-pre.4
|
|
91
|
+
|
|
92
|
+
## 6.4.0-pre.8
|
|
93
|
+
|
|
94
|
+
### Patch Changes
|
|
95
|
+
|
|
96
|
+
- fix: Make path resolution trailing slash agnostic (#8861)
|
|
97
|
+
- fix: Additional logic fixed for relative navigation from index/pathless layout routes (#8985)
|
|
98
|
+
- fix: export ActionFunctionArgs/LoaderFunctionArgs up through router packages (#8975)
|
|
99
|
+
- Updated dependencies
|
|
100
|
+
- @remix-run/router@0.2.0-pre.3
|
|
101
|
+
|
|
102
|
+
## 6.4.0-pre.7
|
|
103
|
+
|
|
104
|
+
### Minor Changes
|
|
105
|
+
|
|
106
|
+
- Add support for functional updates in `useSearchParams` (similar to the `useState` callback signature) (#8955)
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- Properly handle relative navigation from index/pathless routes (#8954)
|
|
111
|
+
- Fix issues building with webpack + React 17 (#8938)
|
|
112
|
+
- Updated dependencies
|
|
113
|
+
- `@remix-run/router@0.2.0-pre.2`
|
|
114
|
+
|
|
115
|
+
## 6.4.0-pre.6
|
|
116
|
+
|
|
117
|
+
## 6.4.0-pre.5
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- Fix broken require for CJS builds
|
|
122
|
+
|
|
123
|
+
## 6.4.0-pre.4
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- Fix missing `dist` files
|
|
128
|
+
|
|
129
|
+
## 6.4.0-pre.3
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- Make `fallbackElement` optional and change type to `ReactNode` (type changes only) (#8896)
|
|
134
|
+
- Properly trigger error boundaries on 404 routes
|
package/LICENSE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
3
|
Copyright (c) React Training 2015-2019
|
|
4
|
-
Copyright (c) Remix Software 2020-
|
|
4
|
+
Copyright (c) Remix Software 2020-2022
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ActionFunction, ActionFunctionArgs, DataRouteMatch, Fetcher, JsonFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, Params, ParamParseKey, Path, PathMatch, PathPattern, RedirectFunction, RouteMatch, RouteObject, ShouldRevalidateFunction, To } from "@remix-run/router";
|
|
2
|
+
import { Action as NavigationType, createPath, deferred, generatePath, isDeferredError, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, resolvePath } from "@remix-run/router";
|
|
3
|
+
import type { DataMemoryRouterProps, DeferredProps, MemoryRouterProps, NavigateProps, OutletProps, RouteProps, PathRouteProps, LayoutRouteProps, IndexRouteProps, RouterProps, RoutesProps } from "./lib/components";
|
|
4
|
+
import { createRoutesFromChildren, renderMatches, DataMemoryRouter, DataRouter, DataRouterProvider, Deferred, MemoryRouter, Navigate, Outlet, Route, Router, Routes } from "./lib/components";
|
|
5
|
+
import type { Navigator, NavigateOptions } from "./lib/context";
|
|
6
|
+
import { DataRouterContext, DataRouterStateContext, DataStaticRouterContext, LocationContext, NavigationContext, RouteContext } from "./lib/context";
|
|
7
|
+
import type { NavigateFunction } from "./lib/hooks";
|
|
8
|
+
import { useHref, useInRouterContext, useLocation, useMatch, useNavigationType, useNavigate, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useActionData, useDeferredData, useLoaderData, useMatches, useRouteLoaderData, useRouteError, useNavigation, useRevalidator } from "./lib/hooks";
|
|
9
|
+
declare type Hash = string;
|
|
10
|
+
declare type Pathname = string;
|
|
11
|
+
declare type Search = string;
|
|
12
|
+
export type { ActionFunction, ActionFunctionArgs, DataMemoryRouterProps, DataRouteMatch, DeferredProps, Fetcher, Hash, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RouteMatch, RouteObject, RouteProps, RouterProps, RoutesProps, Search, ShouldRevalidateFunction, To, };
|
|
13
|
+
export { DataMemoryRouter, Deferred, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, createPath, createRoutesFromChildren, deferred, isDeferredError, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, useDeferredData, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, };
|
|
14
|
+
/** @internal */
|
|
15
|
+
export { DataRouter as UNSAFE_DataRouter, DataRouterProvider as UNSAFE_DataRouterProvider, NavigationContext as UNSAFE_NavigationContext, LocationContext as UNSAFE_LocationContext, RouteContext as UNSAFE_RouteContext, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, DataStaticRouterContext as UNSAFE_DataStaticRouterContext, };
|