@remix-run/router 0.0.0-experimental-4a8a492a → 0.0.0-experimental-e0f088aa
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 +11 -0
- package/dist/router.cjs.js +22 -14
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.d.ts +9 -10
- package/dist/router.js +20 -14
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +22 -14
- package/dist/router.umd.js.map +1 -1
- package/dist/router.umd.min.js +2 -2
- package/dist/router.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/router.ts +34 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# `@remix-run/router`
|
|
2
2
|
|
|
3
|
+
## 1.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add experimental support for the [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition) by allowing users to opt-into view transitions on navigations via the new `unstable_viewTransition` option to `router.navigate` ([#10916](https://github.com/remix-run/react-router/pull/10916))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Allow 404 detection to leverage root route error boundary if path contains a URL segment ([#10852](https://github.com/remix-run/react-router/pull/10852))
|
|
12
|
+
- Fix `ErrorResponse` type to avoid leaking internal field ([#10876](https://github.com/remix-run/react-router/pull/10876))
|
|
13
|
+
|
|
3
14
|
## 1.9.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v0.0.0-experimental-
|
|
2
|
+
* @remix-run/router v0.0.0-experimental-e0f088aa
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1881,8 +1881,17 @@ function createRouter(init) {
|
|
|
1881
1881
|
function updateState(newState, viewTransitionOpts) {
|
|
1882
1882
|
state = _extends({}, state, newState);
|
|
1883
1883
|
subscribers.forEach(subscriber => subscriber(state, {
|
|
1884
|
-
viewTransitionOpts
|
|
1884
|
+
unstable_viewTransitionOpts: viewTransitionOpts
|
|
1885
1885
|
}));
|
|
1886
|
+
|
|
1887
|
+
// Remove idle fetchers from state since we only care about in-flight fetchers.
|
|
1888
|
+
// We keep fetchLoadeMatches around for revalidations purposes.
|
|
1889
|
+
// The React layer persists the data for completed fetchers.
|
|
1890
|
+
state.fetchers.forEach((fetcher, key) => {
|
|
1891
|
+
if (fetcher.state === "idle") {
|
|
1892
|
+
state.fetchers.delete(key);
|
|
1893
|
+
}
|
|
1894
|
+
});
|
|
1886
1895
|
}
|
|
1887
1896
|
|
|
1888
1897
|
// Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION
|
|
@@ -2434,9 +2443,6 @@ function createRouter(init) {
|
|
|
2434
2443
|
fetchers: new Map(state.fetchers)
|
|
2435
2444
|
} : {});
|
|
2436
2445
|
}
|
|
2437
|
-
function getFetcher(key) {
|
|
2438
|
-
return state.fetchers.get(key) || IDLE_FETCHER;
|
|
2439
|
-
}
|
|
2440
2446
|
|
|
2441
2447
|
// Trigger a fetcher load/submit for the given fetcher key
|
|
2442
2448
|
function fetch(key, routeId, href, opts) {
|
|
@@ -2624,7 +2630,7 @@ function createRouter(init) {
|
|
|
2624
2630
|
let doneFetcher = getDoneFetcher(actionResult.data);
|
|
2625
2631
|
state.fetchers.set(key, doneFetcher);
|
|
2626
2632
|
}
|
|
2627
|
-
|
|
2633
|
+
abortStaleFetchLoads(loadId);
|
|
2628
2634
|
|
|
2629
2635
|
// If we are currently in a navigation loading state and this fetcher is
|
|
2630
2636
|
// more recent than the navigation, we want the newer data so abort the
|
|
@@ -2642,12 +2648,11 @@ function createRouter(init) {
|
|
|
2642
2648
|
// otherwise just update with the fetcher data, preserving any existing
|
|
2643
2649
|
// loaderData for loaders that did not need to reload. We have to
|
|
2644
2650
|
// manually merge here since we aren't going through completeNavigation
|
|
2645
|
-
updateState(
|
|
2651
|
+
updateState({
|
|
2646
2652
|
errors,
|
|
2647
|
-
loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors)
|
|
2648
|
-
}, didAbortFetchLoads || revalidatingFetchers.length > 0 ? {
|
|
2653
|
+
loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors),
|
|
2649
2654
|
fetchers: new Map(state.fetchers)
|
|
2650
|
-
}
|
|
2655
|
+
});
|
|
2651
2656
|
isRevalidationRequired = false;
|
|
2652
2657
|
}
|
|
2653
2658
|
}
|
|
@@ -2879,6 +2884,7 @@ function createRouter(init) {
|
|
|
2879
2884
|
}
|
|
2880
2885
|
function deleteFetcher(key) {
|
|
2881
2886
|
let fetcher = state.fetchers.get(key);
|
|
2887
|
+
|
|
2882
2888
|
// Don't abort the controller if this is a deletion of a fetcher.submit()
|
|
2883
2889
|
// in it's loading phase since - we don't want to abort the corresponding
|
|
2884
2890
|
// revalidation and want them to complete and land
|
|
@@ -2898,8 +2904,8 @@ function createRouter(init) {
|
|
|
2898
2904
|
}
|
|
2899
2905
|
function markFetchersDone(keys) {
|
|
2900
2906
|
for (let key of keys) {
|
|
2901
|
-
let fetcher =
|
|
2902
|
-
let doneFetcher = getDoneFetcher(fetcher.data);
|
|
2907
|
+
let fetcher = state.fetchers.get(key);
|
|
2908
|
+
let doneFetcher = getDoneFetcher(fetcher ? fetcher.data : undefined);
|
|
2903
2909
|
state.fetchers.set(key, doneFetcher);
|
|
2904
2910
|
}
|
|
2905
2911
|
}
|
|
@@ -3070,6 +3076,9 @@ function createRouter(init) {
|
|
|
3070
3076
|
get routes() {
|
|
3071
3077
|
return dataRoutes;
|
|
3072
3078
|
},
|
|
3079
|
+
get window() {
|
|
3080
|
+
return routerWindow;
|
|
3081
|
+
},
|
|
3073
3082
|
initialize,
|
|
3074
3083
|
subscribe,
|
|
3075
3084
|
enableScrollRestoration,
|
|
@@ -3080,7 +3089,6 @@ function createRouter(init) {
|
|
|
3080
3089
|
// hash-aware URLs in DOM paths
|
|
3081
3090
|
createHref: to => init.history.createHref(to),
|
|
3082
3091
|
encodeLocation: to => init.history.encodeLocation(to),
|
|
3083
|
-
getFetcher,
|
|
3084
3092
|
deleteFetcher,
|
|
3085
3093
|
dispose,
|
|
3086
3094
|
getBlocker,
|
|
@@ -4266,7 +4274,7 @@ function findNearestBoundary(matches, routeId) {
|
|
|
4266
4274
|
}
|
|
4267
4275
|
function getShortCircuitMatches(routes) {
|
|
4268
4276
|
// Prefer a root layout route if present, otherwise shim in a route object
|
|
4269
|
-
let route = routes.find(r => r.index || !r.path || r.path === "/") || {
|
|
4277
|
+
let route = routes.length === 1 ? routes[0] : routes.find(r => r.index || !r.path || r.path === "/") || {
|
|
4270
4278
|
id: "__shim-error-route__"
|
|
4271
4279
|
};
|
|
4272
4280
|
return {
|