@remix-run/router 0.0.0-experimental-119d5d872 → 0.0.0-experimental-e6fb6e074

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,37 @@
1
1
  # `@remix-run/router`
2
2
 
3
+ ## 1.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add `fetcherKey` as a parameter to `patchRoutesOnNavigation` ([#13109](https://github.com/remix-run/react-router/pull/13109))
8
+
9
+ ### Patch Changes
10
+
11
+ - Fix regression introduced in `6.29.0` via [#12169](https://github.com/remix-run/react-router/pull/12169) that caused issues navigating to hash routes inside splat routes for applications using Lazy Route Discovery (`patchRoutesOnNavigation`) ([#13108](https://github.com/remix-run/react-router/pull/13108))
12
+
13
+ ## 1.22.0
14
+
15
+ ### Minor Changes
16
+
17
+ - Provide the request `signal` as a parameter to `patchRoutesOnNavigation` ([#12900](https://github.com/remix-run/react-router/pull/12900))
18
+
19
+ - This can be used to abort any manifest fetches if the in-flight navigation/fetcher is aborted
20
+
21
+ ### Patch Changes
22
+
23
+ - Do not log v7 deprecation warnings in production builds ([#12794](https://github.com/remix-run/react-router/pull/12794))
24
+ - Strip search parameters from `patchRoutesOnNavigation` `path` param for fetcher calls ([#12899](https://github.com/remix-run/react-router/pull/12899))
25
+ - Properly bubble headers when throwing a `data()` result ([#12845](https://github.com/remix-run/react-router/pull/12845))
26
+ - Optimize route matching by skipping redundant `matchRoutes` calls when possible ([#12169](https://github.com/remix-run/react-router/pull/12169))
27
+
28
+ ## 1.21.1
29
+
30
+ ### Patch Changes
31
+
32
+ - - Fix issue with fetcher data cleanup in the data layer on fetcher unmount ([#12674](https://github.com/remix-run/react-router/pull/12674))
33
+ - Fix behavior of manual fetcher keys when not opted into `future.v7_fetcherPersist`
34
+
3
35
  ## 1.21.0
4
36
 
5
37
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v0.0.0-experimental-119d5d872
2
+ * @remix-run/router v0.0.0-experimental-e6fb6e074
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -2322,6 +2322,21 @@ function createRouter(init) {
2322
2322
  // `matchRoutes()` has already been called if we're in here via `router.initialize()`
2323
2323
  state.matches : matchRoutes(routesToUse, location, basename);
2324
2324
  let flushSync = (opts && opts.flushSync) === true;
2325
+
2326
+ // Short circuit if it's only a hash change and not a revalidation or
2327
+ // mutation submission.
2328
+ //
2329
+ // Ignore on initial page loads because since the initial hydration will always
2330
+ // be "same hash". For example, on /page#hash and submit a <Form method="post">
2331
+ // which will default to a navigation to /page
2332
+ if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {
2333
+ completeNavigation(location, {
2334
+ matches
2335
+ }, {
2336
+ flushSync
2337
+ });
2338
+ return;
2339
+ }
2325
2340
  let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);
2326
2341
  if (fogOfWar.active && fogOfWar.matches) {
2327
2342
  matches = fogOfWar.matches;
@@ -2346,21 +2361,6 @@ function createRouter(init) {
2346
2361
  return;
2347
2362
  }
2348
2363
 
2349
- // Short circuit if it's only a hash change and not a revalidation or
2350
- // mutation submission.
2351
- //
2352
- // Ignore on initial page loads because since the initial hydration will always
2353
- // be "same hash". For example, on /page#hash and submit a <Form method="post">
2354
- // which will default to a navigation to /page
2355
- if (state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {
2356
- completeNavigation(location, {
2357
- matches
2358
- }, {
2359
- flushSync
2360
- });
2361
- return;
2362
- }
2363
-
2364
2364
  // Create a controller/Request for this navigation
2365
2365
  pendingNavigationController = new AbortController();
2366
2366
  let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);
@@ -2856,7 +2856,7 @@ function createRouter(init) {
2856
2856
  let abortController = new AbortController();
2857
2857
  let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);
2858
2858
  if (isFogOfWar) {
2859
- let discoverResult = await discoverRoutes(requestMatches, path, fetchRequest.signal);
2859
+ let discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);
2860
2860
  if (discoverResult.type === "aborted") {
2861
2861
  return;
2862
2862
  } else if (discoverResult.type === "error") {
@@ -3042,7 +3042,7 @@ function createRouter(init) {
3042
3042
  let abortController = new AbortController();
3043
3043
  let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);
3044
3044
  if (isFogOfWar) {
3045
- let discoverResult = await discoverRoutes(matches, path, fetchRequest.signal);
3045
+ let discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);
3046
3046
  if (discoverResult.type === "aborted") {
3047
3047
  return;
3048
3048
  } else if (discoverResult.type === "error") {
@@ -3586,7 +3586,7 @@ function createRouter(init) {
3586
3586
  matches: null
3587
3587
  };
3588
3588
  }
3589
- async function discoverRoutes(matches, pathname, signal) {
3589
+ async function discoverRoutes(matches, pathname, signal, fetcherKey) {
3590
3590
  if (!patchRoutesOnNavigationImpl) {
3591
3591
  return {
3592
3592
  type: "success",
@@ -3600,8 +3600,10 @@ function createRouter(init) {
3600
3600
  let localManifest = manifest;
3601
3601
  try {
3602
3602
  await patchRoutesOnNavigationImpl({
3603
+ signal,
3603
3604
  path: pathname,
3604
3605
  matches: partialMatches,
3606
+ fetcherKey,
3605
3607
  patch: (routeId, children) => {
3606
3608
  if (signal.aborted) return;
3607
3609
  patchRoutesImpl(routeId, children, routesToUse, localManifest, mapRouteProperties);
@@ -4872,18 +4874,24 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
4872
4874
  }
4873
4875
  if (type === ResultType.error) {
4874
4876
  if (isDataWithResponseInit(result)) {
4875
- var _result$init2;
4877
+ var _result$init3, _result$init4;
4876
4878
  if (result.data instanceof Error) {
4877
- var _result$init;
4879
+ var _result$init, _result$init2;
4878
4880
  return {
4879
4881
  type: ResultType.error,
4880
4882
  error: result.data,
4881
- statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status
4883
+ statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,
4884
+ headers: (_result$init2 = result.init) != null && _result$init2.headers ? new Headers(result.init.headers) : undefined
4882
4885
  };
4883
4886
  }
4884
4887
 
4885
4888
  // Convert thrown data() to ErrorResponse instances
4886
- result = new ErrorResponseImpl(((_result$init2 = result.init) == null ? void 0 : _result$init2.status) || 500, undefined, result.data);
4889
+ return {
4890
+ type: ResultType.error,
4891
+ error: new ErrorResponseImpl(((_result$init3 = result.init) == null ? void 0 : _result$init3.status) || 500, undefined, result.data),
4892
+ statusCode: isRouteErrorResponse(result) ? result.status : undefined,
4893
+ headers: (_result$init4 = result.init) != null && _result$init4.headers ? new Headers(result.init.headers) : undefined
4894
+ };
4887
4895
  }
4888
4896
  return {
4889
4897
  type: ResultType.error,
@@ -4892,21 +4900,21 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
4892
4900
  };
4893
4901
  }
4894
4902
  if (isDeferredData(result)) {
4895
- var _result$init3, _result$init4;
4903
+ var _result$init5, _result$init6;
4896
4904
  return {
4897
4905
  type: ResultType.deferred,
4898
4906
  deferredData: result,
4899
- statusCode: (_result$init3 = result.init) == null ? void 0 : _result$init3.status,
4900
- headers: ((_result$init4 = result.init) == null ? void 0 : _result$init4.headers) && new Headers(result.init.headers)
4907
+ statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status,
4908
+ headers: ((_result$init6 = result.init) == null ? void 0 : _result$init6.headers) && new Headers(result.init.headers)
4901
4909
  };
4902
4910
  }
4903
4911
  if (isDataWithResponseInit(result)) {
4904
- var _result$init5, _result$init6;
4912
+ var _result$init7, _result$init8;
4905
4913
  return {
4906
4914
  type: ResultType.data,
4907
4915
  data: result.data,
4908
- statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status,
4909
- headers: (_result$init6 = result.init) != null && _result$init6.headers ? new Headers(result.init.headers) : undefined
4916
+ statusCode: (_result$init7 = result.init) == null ? void 0 : _result$init7.status,
4917
+ headers: (_result$init8 = result.init) != null && _result$init8.headers ? new Headers(result.init.headers) : undefined
4910
4918
  };
4911
4919
  }
4912
4920
  return {