@remix-run/router 1.6.1 → 1.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix-run/router",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Nested/Data-driven/Framework-agnostic Routing",
5
5
  "keywords": [
6
6
  "remix",
package/router.ts CHANGED
@@ -1225,10 +1225,13 @@ export function createRouter(init: RouterInit): Router {
1225
1225
  return;
1226
1226
  }
1227
1227
 
1228
- // Short circuit if it's only a hash change and not a mutation submission
1228
+ // Short circuit if it's only a hash change and not a mutation submission.
1229
+ // Ignore on initial page loads because since the initial load will always
1230
+ // be "same hash".
1229
1231
  // For example, on /page#hash and submit a <Form method="post"> which will
1230
1232
  // default to a navigation to /page
1231
1233
  if (
1234
+ state.initialized &&
1232
1235
  isHashChangeOnly(state.location, location) &&
1233
1236
  !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))
1234
1237
  ) {
@@ -2474,7 +2477,13 @@ export function createRouter(init: RouterInit): Router {
2474
2477
  }
2475
2478
 
2476
2479
  function _internalSetRoutes(newRoutes: AgnosticDataRouteObject[]) {
2477
- inFlightDataRoutes = newRoutes;
2480
+ manifest = {};
2481
+ inFlightDataRoutes = convertRoutesToDataRoutes(
2482
+ newRoutes,
2483
+ mapRouteProperties,
2484
+ undefined,
2485
+ manifest
2486
+ );
2478
2487
  }
2479
2488
 
2480
2489
  router = {
@@ -4009,16 +4018,18 @@ function isHashChangeOnly(a: Location, b: Location): boolean {
4009
4018
  }
4010
4019
 
4011
4020
  if (a.hash === "") {
4012
- // No hash -> hash
4021
+ // /page -> /page#hash
4013
4022
  return b.hash !== "";
4014
4023
  } else if (a.hash === b.hash) {
4015
- // current hash -> same hash
4024
+ // /page#hash -> /page#hash
4016
4025
  return true;
4017
4026
  } else if (b.hash !== "") {
4018
- // current hash -> new hash
4027
+ // /page#hash -> /page#other
4019
4028
  return true;
4020
4029
  }
4021
4030
 
4031
+ // If the hash is removed the browser will re-perform a request to the server
4032
+ // /page#hash -> /page
4022
4033
  return false;
4023
4034
  }
4024
4035