@tanstack/router-core 0.0.1-beta.52 → 0.0.1-beta.54

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.
@@ -271,7 +271,7 @@ declare class Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRout
271
271
  gcMaxAge?: never;
272
272
  }) => Promise<void>;
273
273
  loadMatchData: (routeMatch: RouteMatch<any, any>) => Promise<Record<string, unknown>>;
274
- invalidateRoute: (opts: MatchLocation) => Promise<void>;
274
+ invalidateRoute: <TFrom extends ValidFromPath<TAllRouteInfo> = "/", TTo extends string = ".">(opts: ToOptions<TAllRouteInfo, TFrom, TTo, ResolveRelativePath<TFrom, NoInfer<TTo>>>) => Promise<void>;
275
275
  reload: () => void;
276
276
  resolvePath: (from: string, path: string) => string;
277
277
  navigate: <TFrom extends ValidFromPath<TAllRouteInfo> = "/", TTo extends string = ".">({ from, to, search, hash, replace, params, }: NavigateOptions<TAllRouteInfo, TFrom, TTo>) => Promise<void>;
@@ -149,10 +149,9 @@
149
149
  function parseLocation(href, state) {
150
150
  let hashIndex = href.indexOf('#');
151
151
  let searchIndex = href.indexOf('?');
152
- const pathEnd = Math.min(hashIndex, searchIndex);
153
152
  return {
154
153
  href,
155
- pathname: pathEnd > -1 ? href.substring(0, pathEnd) : href,
154
+ pathname: href.substring(0, hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : href.length),
156
155
  hash: hashIndex > -1 ? href.substring(hashIndex, searchIndex) : '',
157
156
  search: searchIndex > -1 ? href.substring(searchIndex) : '',
158
157
  state
@@ -1356,7 +1355,7 @@
1356
1355
  // If this `to` is a valid external URL, return
1357
1356
  // null for LinkUtils
1358
1357
  const toString = String(to);
1359
- const fromString = String(from);
1358
+ const fromString = typeof from === 'undefined' ? from : String(from);
1360
1359
  let isExternal;
1361
1360
  try {
1362
1361
  new URL(`${toString}`);