@remix-run/router 1.3.1-pre.0 → 1.3.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 CHANGED
@@ -1,14 +1,17 @@
1
1
  # `@remix-run/router`
2
2
 
3
- ## 1.3.1-pre.0
3
+ ## 1.3.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Respect `preventScrollReset` on `fetcher.Form` ([#9963](https://github.com/remix-run/react-router/pull/9963))
8
- - Fix revalidating fetcher `shouldRevalidate` params ([#9948](https://github.com/remix-run/react-router/pull/9948))
7
+ - Fixes 2 separate issues for revalidating fetcher `shouldRevalidate` calls ([#9948](https://github.com/remix-run/react-router/pull/9948))
8
+ - The `shouldRevalidate` function was only being called for _explicit_ revalidation scenarios (after a mutation, manual `useRevalidator` call, or an `X-Remix-Revalidate` header used for cookie setting in Remix). It was not properly being called on _implicit_ revalidation scenarios that also apply to navigation `loader` revalidation, such as a change in search params or clicking a link for the page we're already on. It's now correctly called in those additional scenarios.
9
+ - The parameters being passed were incorrect and inconsistent with one another since the `current*`/`next*` parameters reflected the static `fetcher.load` URL (and thus were identical). Instead, they should have reflected the the navigation that triggered the revalidation (as the `form*` parameters did). These parameters now correctly reflect the triggering navigation.
10
+ - Respect `preventScrollReset` on `<fetcher.Form>` ([#9963](https://github.com/remix-run/react-router/pull/9963))
9
11
  - Do not short circuit on hash change only mutation submissions ([#9944](https://github.com/remix-run/react-router/pull/9944))
10
12
  - Remove `instanceof` check from `isRouteErrorResponse` to avoid bundling issues on the server ([#9930](https://github.com/remix-run/react-router/pull/9930))
11
- - Detect no lazy data and remove abort controller for `defer` ([#9965](https://github.com/remix-run/react-router/pull/9965))
13
+ - Fix navigation for hash routers on manual URL changes ([#9980](https://github.com/remix-run/react-router/pull/9980))
14
+ - Detect when a `defer` call only contains critical data and remove the `AbortController` ([#9965](https://github.com/remix-run/react-router/pull/9965))
12
15
  - Send the name as the value when url-encoding `File` `FormData` entries ([#9867](https://github.com/remix-run/react-router/pull/9867))
13
16
 
14
17
  ## 1.3.0
package/dist/history.d.ts CHANGED
@@ -71,7 +71,7 @@ export interface Update {
71
71
  /**
72
72
  * The delta between this location and the former location in the history stack
73
73
  */
74
- delta: number;
74
+ delta: number | null;
75
75
  }
76
76
  /**
77
77
  * A function that receives notifications about location changes.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v1.3.1-pre.0
2
+ * @remix-run/router v1.3.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -433,23 +433,17 @@ function getUrlBasedHistory(getLocation, createHref, validateLocation, options)
433
433
  }
434
434
 
435
435
  function handlePop() {
436
- let nextAction = exports.Action.Pop;
436
+ action = exports.Action.Pop;
437
437
  let nextIndex = getIndex();
438
+ let delta = nextIndex == null ? null : nextIndex - index;
439
+ index = nextIndex;
438
440
 
439
- if (nextIndex != null) {
440
- let delta = nextIndex - index;
441
- action = nextAction;
442
- index = nextIndex;
443
-
444
- if (listener) {
445
- listener({
446
- action,
447
- location: history.location,
448
- delta
449
- });
450
- }
451
- } else {
452
- warning$1(false, "You are trying to perform a POP navigation to a location that was not " + "created by @remix-run/router. This will fail silently in production. " + "You should navigate via the router to avoid this situation (instead of " + "using window.history.pushState/window.location.hash).");
441
+ if (listener) {
442
+ listener({
443
+ action,
444
+ location: history.location,
445
+ delta
446
+ });
453
447
  }
454
448
  }
455
449
 
@@ -1619,13 +1613,14 @@ function createRouter(init) {
1619
1613
  return;
1620
1614
  }
1621
1615
 
1616
+ warning(activeBlocker != null && 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.");
1622
1617
  let blockerKey = shouldBlockNavigation({
1623
1618
  currentLocation: state.location,
1624
1619
  nextLocation: location,
1625
1620
  historyAction
1626
1621
  });
1627
1622
 
1628
- if (blockerKey) {
1623
+ if (blockerKey && delta != null) {
1629
1624
  // Restore the URL to match the current UI, but don't update router state
1630
1625
  ignoreNextHistoryUpdate = true;
1631
1626
  init.history.go(delta * -1); // Put the blocker into a blocked state