@remix-run/router 0.0.0-experimental-d7bf770a8 → 0.0.0-experimental-7d87ffb8c
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/dist/router.cjs.js +15 -8
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +15 -8
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +15 -8
- 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 +16 -7
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-7d87ffb8c
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1926,7 +1926,7 @@ function createRouter(init) {
|
|
|
1926
1926
|
|
|
1927
1927
|
// Flag to ignore the next history update, so we can revert the URL change on
|
|
1928
1928
|
// a POP navigation that was blocked by the user without touching router state
|
|
1929
|
-
let
|
|
1929
|
+
let unblockBlockerHistoryUpdate = undefined;
|
|
1930
1930
|
|
|
1931
1931
|
// Initialize the router, all side effects should be kicked off from here.
|
|
1932
1932
|
// Implemented as a Fluent API for ease of:
|
|
@@ -1942,8 +1942,9 @@ function createRouter(init) {
|
|
|
1942
1942
|
} = _ref;
|
|
1943
1943
|
// Ignore this event if it was just us resetting the URL from a
|
|
1944
1944
|
// blocked POP navigation
|
|
1945
|
-
if (
|
|
1946
|
-
|
|
1945
|
+
if (unblockBlockerHistoryUpdate) {
|
|
1946
|
+
unblockBlockerHistoryUpdate();
|
|
1947
|
+
unblockBlockerHistoryUpdate = undefined;
|
|
1947
1948
|
return;
|
|
1948
1949
|
}
|
|
1949
1950
|
warning(blockerFunctions.size === 0 || delta != null, "You are trying to use a blocker on a POP navigation to a location " + "that was not created by @remix-run/router. This will fail silently in " + "production. This can happen if you are navigating outside the router " + "via `window.history.pushState`/`window.location.hash` instead of using " + "router navigation APIs. This can also happen if you are using " + "createHashRouter and the user manually changes the URL.");
|
|
@@ -1954,7 +1955,9 @@ function createRouter(init) {
|
|
|
1954
1955
|
});
|
|
1955
1956
|
if (blockerKey && delta != null) {
|
|
1956
1957
|
// Restore the URL to match the current UI, but don't update router state
|
|
1957
|
-
|
|
1958
|
+
let nextHistoryUpdatePromise = new Promise(resolve => {
|
|
1959
|
+
unblockBlockerHistoryUpdate = resolve;
|
|
1960
|
+
});
|
|
1958
1961
|
init.history.go(delta * -1);
|
|
1959
1962
|
|
|
1960
1963
|
// Put the blocker into a blocked state
|
|
@@ -1968,8 +1971,10 @@ function createRouter(init) {
|
|
|
1968
1971
|
reset: undefined,
|
|
1969
1972
|
location
|
|
1970
1973
|
});
|
|
1971
|
-
// Re-do the same POP navigation we just blocked
|
|
1972
|
-
|
|
1974
|
+
// Re-do the same POP navigation we just blocked, after the url
|
|
1975
|
+
// restoration is also complete. See:
|
|
1976
|
+
// https://github.com/remix-run/react-router/issues/11613
|
|
1977
|
+
nextHistoryUpdatePromise.then(() => init.history.go(delta));
|
|
1973
1978
|
},
|
|
1974
1979
|
reset() {
|
|
1975
1980
|
let blockers = new Map(state.blockers);
|
|
@@ -2289,7 +2294,9 @@ function createRouter(init) {
|
|
|
2289
2294
|
// navigation to the navigation.location but do not trigger an uninterrupted
|
|
2290
2295
|
// revalidation so that history correctly updates once the navigation completes
|
|
2291
2296
|
startNavigation(pendingAction || state.historyAction, state.navigation.location, {
|
|
2292
|
-
overrideNavigation: state.navigation
|
|
2297
|
+
overrideNavigation: state.navigation,
|
|
2298
|
+
// Proxy through any rending view transition
|
|
2299
|
+
enableViewTransition: pendingViewTransitionEnabled === true
|
|
2293
2300
|
});
|
|
2294
2301
|
}
|
|
2295
2302
|
|