react-router-dom-v5-compat 6.21.1 → 6.21.2

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,5 +1,13 @@
1
1
  # `react-router-dom-v5-compat`
2
2
 
3
+ ## 6.21.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies:
8
+ - `react-router-dom@6.21.2`
9
+ - `react-router@6.21.2`
10
+
3
11
  ## 6.21.1
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router DOM v5 Compat v6.21.1
2
+ * React Router DOM v5 Compat v6.21.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -330,6 +330,8 @@ const START_TRANSITION = "startTransition";
330
330
  const startTransitionImpl = React[START_TRANSITION];
331
331
  const FLUSH_SYNC = "flushSync";
332
332
  const flushSyncImpl = ReactDOM[FLUSH_SYNC];
333
+ const USE_ID = "useId";
334
+ const useIdImpl = React[USE_ID];
333
335
  function startTransitionSafe(cb) {
334
336
  if (startTransitionImpl) {
335
337
  startTransitionImpl(cb);
@@ -1135,10 +1137,14 @@ function useFetcher(_temp3) {
1135
1137
  !route ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "useFetcher must be used inside a RouteContext") : UNSAFE_invariant(false) : void 0;
1136
1138
  !(routeId != null) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "useFetcher can only be used on routes that contain a unique \"id\"") : UNSAFE_invariant(false) : void 0;
1137
1139
  // Fetcher key handling
1138
- let [fetcherKey, setFetcherKey] = React.useState(key || "");
1140
+ // OK to call conditionally to feature detect `useId`
1141
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1142
+ let defaultKey = useIdImpl ? useIdImpl() : "";
1143
+ let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey);
1139
1144
  if (key && key !== fetcherKey) {
1140
1145
  setFetcherKey(key);
1141
1146
  } else if (!fetcherKey) {
1147
+ // We will only fall through here when `useId` is not available
1142
1148
  setFetcherKey(getUniqueFetcherId());
1143
1149
  }
1144
1150
  // Registration/cleanup