@remix-run/router 1.3.0-pre.0 → 1.3.0-pre.1
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 +6 -0
- package/dist/router.cjs.js +14 -8
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.d.ts +1 -0
- package/dist/router.js +14 -8
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +14 -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 +18 -5
package/dist/router.d.ts
CHANGED
package/dist/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.3.0-pre.
|
|
2
|
+
* @remix-run/router v1.3.0-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1542,7 +1542,7 @@ function createRouter(init) {
|
|
|
1542
1542
|
|
|
1543
1543
|
|
|
1544
1544
|
function completeNavigation(location, newState) {
|
|
1545
|
-
var _location$state;
|
|
1545
|
+
var _location$state, _location$state2;
|
|
1546
1546
|
|
|
1547
1547
|
// Deduce if we're in a loading/actionReload state:
|
|
1548
1548
|
// - We have committed actionData in the store
|
|
@@ -1568,7 +1568,10 @@ function createRouter(init) {
|
|
|
1568
1568
|
} // Always preserve any existing loaderData from re-used routes
|
|
1569
1569
|
|
|
1570
1570
|
|
|
1571
|
-
let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;
|
|
1571
|
+
let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData; // Always respect the user flag. Otherwise don't reset on mutation
|
|
1572
|
+
// submission navigations unless they redirect
|
|
1573
|
+
|
|
1574
|
+
let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true;
|
|
1572
1575
|
updateState(_extends({}, newState, {
|
|
1573
1576
|
actionData,
|
|
1574
1577
|
loaderData,
|
|
@@ -1577,9 +1580,8 @@ function createRouter(init) {
|
|
|
1577
1580
|
initialized: true,
|
|
1578
1581
|
navigation: IDLE_NAVIGATION,
|
|
1579
1582
|
revalidation: "idle",
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
preventScrollReset: pendingPreventScrollReset
|
|
1583
|
+
restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches),
|
|
1584
|
+
preventScrollReset
|
|
1583
1585
|
}));
|
|
1584
1586
|
|
|
1585
1587
|
if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) {
|
|
@@ -2403,7 +2405,9 @@ function createRouter(init) {
|
|
|
2403
2405
|
await startNavigation(redirectHistoryAction, redirectLocation, {
|
|
2404
2406
|
submission: _extends({}, submission, {
|
|
2405
2407
|
formAction: redirect.location
|
|
2406
|
-
})
|
|
2408
|
+
}),
|
|
2409
|
+
// Preserve this flag across redirects
|
|
2410
|
+
preventScrollReset: pendingPreventScrollReset
|
|
2407
2411
|
});
|
|
2408
2412
|
} else {
|
|
2409
2413
|
// Otherwise, we kick off a new loading navigation, preserving the
|
|
@@ -2416,7 +2420,9 @@ function createRouter(init) {
|
|
|
2416
2420
|
formAction: submission ? submission.formAction : undefined,
|
|
2417
2421
|
formEncType: submission ? submission.formEncType : undefined,
|
|
2418
2422
|
formData: submission ? submission.formData : undefined
|
|
2419
|
-
}
|
|
2423
|
+
},
|
|
2424
|
+
// Preserve this flag across redirects
|
|
2425
|
+
preventScrollReset: pendingPreventScrollReset
|
|
2420
2426
|
});
|
|
2421
2427
|
}
|
|
2422
2428
|
}
|